s = input()
f = s
while True:
    s = s.replace('10', '')
    s = s.replace('01', '')
    t = list(s)
    if all(map(lambda x:x=="1", t)):
        break
    if all(map(lambda x:x=="0", t)):
        break
print(len(f)-len(s))