def myAnswer(S:list) -> int:
   counter = 0
   while True:
      for i in range(len(S)-1):
         if(S[i]!=S[i+1]):
            S.pop(i)
            S.pop(i)
            counter += 2
            break
      else:
         break
   return counter

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()