N = input()
found = True
count = 0
while found:
  found = False
  dummy = ""
  for i in range(len(N) - 1):
    if N[i] != N[i+1]:
      count += 2
      dummy = N[:i] + N[i+2:]
      N = dummy
      found = True
      break
print(count)