S = list(input())

flag = True
total = len(S)

while flag:
  for i in range(len(S)-1):
    if S[i] != S[i+1]:
      del S[i]
      del S[i]
      break
  else:
    flag = False
      
print(total - len(S))