# -*- coding: utf-8 -*-

S = input()
cnt = 0

# O(N^2)は不可。
# 010がある時、01と10を取り除くパターンを作る？
s = S
while True:
    ls = len(s)
    s1 = s.replace("01", "")
    s2 = s.replace("01", "")
    ls1 = len(s1)
    ls2 = len(s2)
    if ls == ls1 and ls == ls2:
        break
    elif ls1 <= ls2:
        cnt += (ls - ls1)
        s = s1
    else:
        cnt += (ls - ls2)
        s = s2

print(cnt)
