S = input()

cnt = 0

while True:
    sRep = S.replace('01', '')
    if len(sRep) != len(S):
        cnt += len(S) - len(sRep)
        S = sRep
        #print(S, cnt)
    else:
        break

print(cnt)
