def meh(captcha):
    """Returns the sum of the digits which match the next one in the captcha
    input string.

    >>> meh('1122')
    3
    >>> meh('1111')
    4
    >>> meh('1234')
    0
    >>> meh('91212129')
    9
    """
    result = 0
    for n in range(len(captcha)):
        if captcha[n] == captcha[(n + 1) % len(captcha)]:
            result += int(captcha[n])
    return result