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

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

    >>> solve('1122')
    3
    >>> solve('1111')
    4
    >>> solve('98769')
    9
    """

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