import copy

S = input()

len_S = len(S)

old_len_S = copy.copy(len_S)
for i in range(len_S):
    S = S.replace("10", "")
    S = S.replace("01", "")
    if old_len_S == len(S):
        break
    else:
        old_len_S = len(S)

print(len_S - len(S))