def f(s):
  r=0
  for i,x in enumerate(s):
    if len(s)==i+1:
      break
    if(x!=s[i+1]):
      del s[i]
      del s[i]
      r+=2
      break
  return r

s=input()
s=list(s)

r=0

while True:
  buf=f(s)
  r+=buf
  if buf==0:
    break

print(r)