S=eval(input())

stack=[]

count=0

for s in S:

    if not stack:

        stack.append(s)

    elif stack[-1]!=s:

        stack.pop()

        count+=2

    else:

        stack.append(s)

print(count)
S=eval(input())

A=S.count('0')

B=S.count('1')

C=min(A,B)

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

S = eval(input())
A = S.count("0")
B = S.count("1")
C = min(A, B)
print((C * 2))

-stack = [] -count = 0 -for s in S: -    if not stack: -        stack.append(s) -    elif stack[-1] != s: -        stack.pop() -        count += 2 -    else: -        stack.append(s) -print(count) +A = S.count("0") +B = S.count("1") +C = min(A, B) +print((C * 2))