S = input()
initial_length = len(S)

if initial_length == 1:
    print("0")
else:
    len_S = 0
    while len_S != len(S):
        len_S = len(S)
        S = S.replace("10", "")
        S = S.replace("01", "")
    print(initial_length - len(S))