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

for _ in range(10000):
        s=s.replace('01','')
        s=s.replace('10','')
        d=s.count('01')
        e=s.count('10')
        if d==0 and e==0:
                break
print(c-len(s))