# 2019-08-31 19:48:42
S = input()
f = True
count = 0
while f:
    b = len(S)
    S = S.replace("01", "")
    S = S.replace("10", "")
    if b != len(S):
        count = count + b - len(S)
    else:
        f = False
print(count)
