from sys import stdin

S = stdin.readline().rstrip()

beforeS = S

while(True):
    after_S = S.replace("01", "").replace("10", "")
    if len(after_S) != len(S):
        S = after_S
    else:
        break

print(len(beforeS) - len(S))