import sys
input = sys.stdin.readline

S = input()
stack = []
count = 0
for s in S:
  if not stack:
    stack.append(s)
  elif s != stack[-1]:
    stack.pop()
    count += 2
  else:
    stack.append(s)
print(count)    