s = list(input())
counter = 0
flag = True
while flag:
  for pointer in range(0, len(s)-1):
    if s[pointer] != s[pointer + 1]:
      del s[pointer:pointer+2]
      counter += 2
      break
  else:
    flag = False
print(counter)