from sys import stdin

S = stdin.readline().rstrip()

count = 0
prev_S = ""
while(True):
    if S == prev_S or S == "":
        break
    prev_S = S
    S = S.replace("01", "").replace("10", "")
    count += len(prev_S) - len(S)

print(count)