S = input()
stack = []
for s in S:
    if not stack:
        stack.append(s)
    else:
        if s == stack[-1]:
            stack.append(s)
        else:
            stack.pop()
print(len(S)-len(stack)) S = input() S input() input stack = [] stack [] for s in S:
    if not stack:
        stack.append(s)
    else:
        if s == stack[-1]:
            stack.append(s)
        else:
            stack.pop() s S if not stack:
        stack.append(s)
    else:
        if s == stack[-1]:
            stack.append(s)
        else:
            stack.pop() not stack stack stack.append(s) stack.append stack append s if s == stack[-1]:
            stack.append(s)
        else:
            stack.pop() s == stack[-1] s stack[-1] stack -1 stack.append(s) stack.append stack append s stack.pop() stack.pop stack pop print(len(S)-len(stack)) print len(S)-len(stack) len(S) len S len(stack) len stack stack = [] [] stack S = input() input() S
S = input()
stack = []
for s in S:
    if not stack:
        stack.append(s)
    else:
        if s == stack[-1]:
            stack.append(s)
        else:
            stack.pop()
print(len(S)-len(stack))