S = input()
Slength = len(S)

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




while True:
    T = remove(S)

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

print(Slength-len(T))