def solve(captcha):
    """Solve captcha.

    :input: captcha string
    :return: sum of all paired digits that match

    >>> solve('1212')
    6
    >>> solve('1221')
    0
    >>> solve('123425')
    4
    >>> solve('123123')
    12
    >>> solve('12131415')
    4
    """
    a = len(captcha) // 2

    return sum(int(x) for x, y in
               zip(captcha, captcha[a:] + captcha[:a]) if x == y)