s = input()
input_len = len(s)

for i in range(100000):
  sa = s.replace('10','')
  if len(sa)!=len(s):
    s=sa
  sb = s.replace('01','')
  if len(sb)!=len(s):
    s=sb
  if len(sa) == len(s) & len(sb) == len(s):
    break
print(input_len-len(s))