s = input()
stack = []

count = 0

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

count = 0

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