S=input().strip()
N=len(S)
q = [S]
while q:
    s = q.pop()
    p = ''
    v = 0
    for i,c in enumerate(s):
        if (p == '0' and c == '1') or (p == '1' and c == '0'):
            q.append(s[:i-1]+s[i+1:])
            v += 1
        p = c
    if v == 0:
        print(N-len(s))
        break