s = input()
origin = s
past = ''
cnt=0
while True:
    past = s
    s = s.replace('10','').replace('01','')
    print(s)
    print(past)
    if past==s:
        break

num = len(origin)-len(s)
print(num)