S = input()
T = str(S)

now_size = len(T)

while True:

    T = T.replace('01','')
    T = T.replace('10','')

    if now_size == len(T):
        break
    else:
        now_size = len(T)

print(len(S) - len(T))