from itertools import chain


def f(s):
    l = s.split('01')
    for i in range(len(l)):
        l[i] = l[i].split('10')
    l = list(chain.from_iterable(l))
    return l


s = input().rstrip()

count = 0
while True:
    l = f(s)
    if len(l) == 1:
        break
    count += (len(l) - 1) * 2
    s = ''.join(l)

print(count)
