import sys
S = list(input())

if len(S) == 1:
  print(0)
  sys.exit()

cnt = 0
while True:
  o = True
  i=0
  while i < len(S)-1:
    s=S[i]
    if s != S[i+1]:
      S.pop(i)
      S.pop(i)
      o = False
      cnt += 2
      break
    i+=1
  if o:
    break

print(cnt)