s = input()

ans = 0
while '01' in s or '10' in s:
    s_next = s.replace('01', '')
    ans += len(s) - len(s_next)
    s = s_next
    s_next = s.replace('10', '')
    ans += len(s) - len(s_next)
    s = s_next
print(ans)
