s=list(str(input()))
c=len(s)

for _ in range(100):
        for i in range(len(s)-1):
                if s[i]==str(0) and s[i+1]==str(1):
                        s[i]=''
                        s[i+1]=''
                elif s[i]==str(1)  and s[i+1]==str(0):
                        s[i]=''
                        s[i+1]=''
        l=s
        s=[]
        for i in range(len(l)):
                if l[i]==str(0) or l[i]==str(1):
                        s.append(l[i])
print(c-len(s))