import re
S = input()
count = 0
Olength = len(S)
previousCount = 0

while(1) :
    S = re.sub("(01|10)", "", S)
    count = count + (Olength - len(S))
    Olength = len(S)
    
    if previousCount == count :
        break
    previousCount = count
print(count)