s = input()
l = len(s)

def df(s):
  while True:
    if '01' in s or '10' in s:
      s = s.replace('01', '')
      s = s.replace('10', '')
    else:
      break
  return s

if len(s) < 1000:
  print(l - len(df(s)))
else:
  i = l // 4
  sx = df(s[:i]) + df(s[i:i * 2]) \
         + df(s[i * 2:i * 3]) + df(s[i * 3:])
  print(l - len(df(sx)))