s=input()
orig = len(s)
while True:
    s = list(s)
    for i in range(1, len(s)):
        if s[i] == '0' and s[i-1] == '1':
            s[i] = 'x'
            s[i-1] = 'x'
        elif s[i-1] == '0' and s[i] == '1':
            s[i] = 'x'
            s[i-1] = 'x'
    s = ''.join(s)
    if s == s.replace('x', ''):
        break
    s=s.replace('x', '')
print(orig-len(s))