from itertools import chain
import sys
sys.setrecursionlimit(99999)

s = input().rstrip()

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))
    if len(l) == 1:
        return 0
    else:
        r = (len(l) - 1) * 2
        return r + f(''.join(l))

print(f(s))
