S=list(input())
count=0
N=len(S)
for j in range(N//2):
  if len(S)<=1:
    break
  if (sum(S)==0)or(sum(S)==len(S)):
    break
  i=0
  while True:
    if S[i]!=S[i+1]:
      count+=1
      del S[i:i+2]
      i-=1
    i+=1
    if i>=len(S)-1:
      break
print(2*count)