#ABC120C-Unification.py

from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = 0

while '0' in S and '1' in S:
    s = S.split('10')
    Nblock += (len(s)-1)*2
    S = ''.join(s)
    t = S.split('01')
    Nblock += (len(t)-1)*2
    S = ''.join(t)


print(Nblock)
