s = input()
count = 0
while True:
    m = len(s)
    s = s.replace('10','')
    count += m-len(s)
    n = len(s)
    s = s.replace('01','')
    count += n-len(s)
    if m == len(s):
        break
    n = len(s)
print(count)