a = input()
a = list(a)
prev = '0'
i = 0
c = 0
d = True
while(d):
  if(a != []):
    if(i > 0 and a[i] != prev):
      a.pop(i-1)
      a.pop(i-1)
      c += 2
      i = 0
      continue
    prev = a[i]
    if(i == len(a) - 1):
      break
  else:
    d = False 
  i += 1
print(c)