in_s = input().rstrip()
s_old = in_s
while True:
    s_new = s_old.replace("10","")
    s_new = s_new.replace("01","")
    if s_new == s_old:
        break
    s_old = s_new
print(len(in_s) - len(s_new))