S = input()
Slength = len(S)

def remove01(preS):
    return "".join(preS.split('01'))

def remove10(preS):
    return "".join(preS.split('10'))



while True:
    T = remove10(remove01(S))

    if T == S:
        break
    else:
        S = T
    

print(Slength-len(T))