S = input()
ans = 0

while(1):
    before = len(S)
    S = S.replace("01","")
    S = S.replace("10","")
    after = len(S)
    if before - after  == 0:
        break
    else:
        ans += before - after




print(ans)