S = list(input())

count = 0
is_continue = False

while True:
  is_continue = False
  for i in range(len(S) - 2):
    if S[i] != S[i+1]:
      S.pop(i)
      S.pop(i)
      count += 2
      is_continue = True
      break
  
  if is_continue == False:
    if len(S) >= 2:
      if S[0] != S[1]:
        S.pop(0)
        S.pop(0)
        count += 2
    print(count)
    exit()