s = input()
n = len(s)
stack = []
for i in s:
    if stack and stack[-1] != i:
        stack.pop()
    else:
        stack.append(i)
print(n - len(stack)) s = input() s input() input n = len(s) n len(s) len s stack = [] stack [] for i in s:
    if stack and stack[-1] != i:
        stack.pop()
    else:
        stack.append(i) i s if stack and stack[-1] != i:
        stack.pop()
    else:
        stack.append(i) stack and stack[-1] != i stack stack[-1] != i stack[-1] stack -1 i stack.pop() stack.pop stack pop stack.append(i) stack.append stack append i print(n - len(stack)) print n - len(stack) n len(stack) len stack n = len(s) len(s) n stack = [] [] stack s = input() input() s
s = input()
n = len(s)
stack = []
for i in s:
    if stack and stack[-1] != i:
        stack.pop()
    else:
        stack.append(i)
print(n - len(stack))