a=[100]+[int(i) for i in input()]+[100]
n=len(a)
i=1
while i<len(a)-1:
    if a[i]^1==a[i+1]:
        a.pop(i)
        a.pop(i+1)
    if a[i]^1==a[i-1]:
        a.pop(i)
        a.pop(i-1)
    else:
        i+=1
print(n-len(a))

    
    
    
    