# -*- coding: utf-8 -*-

S = input()

S = list(S)
i = 0
count = 0
flag=0
while i < len(S)-1:
  i+=1
  if S[i] != S[i-1]:
    S.pop(i-1)
    S.pop(i-1)
    count +=2
    i -=1
    flag=1
  if flag == 1 and i==len(S)-1:
    flag=0
    i=0
print(count)