s=input()

s_len_init = len(s) 
while(1):
    s_len = len(s)
    s = s.replace('01','')
    if s_len == len(s):
        break
    else:
        continue
while(1):
    s_len = len(s)
    s = s.replace('10','')
    if s_len == len(s):
        break
    else:
        continue
print(s_len_init-len(s))