S = input()
initial_len_S = len(S)
len_S = 1e10
len_S_new = 1e10 - 1

while (len_S_new < len_S):
    len_S= len(S)
    S = S.replace("10", "").replace("01","")
    len_S_new = len(S)

print(initial_len_S - len_S)