# -*- coding: utf-8 -*-
S = input()
s=S
ans=0
while True:
    s=s.replace('10','')
    s=s.replace('01','')

    cnt10=s.count('10')
    cnt01=s.count('01')
       
    if cnt10==0 and cnt01==0:
        break
print(len(S)-len(s))