S = str(input())
ans = 0
while True:
    S = S.replace("01", "R")
    a = S.count("R") + S.count("10")
    if  a > 0:
        ans += a*2
        S = S.replace("R","")
        S = S.replace("10","")
    else:
        break
print(ans)