S = input()
S_len = len(S)
ans = 0
while(S.count("01") != 0 or S.count("10") != 0):
    S = S.replace("01","")
    S = S.replace("10","")
    count = S_len - len(S)
    ans += count
    S_len = len(S)

print(ans)
