S = eval(input())

a = sum([int(S[i]) for i in range(len(S))])

b = len(S) - a

print((2*min(a, b)))
S = eval(input())

stack = []

stack.append(S[0])

for i in range(1, len(S)):

    if len(stack) == 0:

        stack.append(S[i])

        continue

    cube = stack.pop()

    if cube != S[i]:

        continue

    stack.append(cube)

    stack.append(S[i])

print((len(S) - len(stack)))

S = eval(input())
a = sum([int(S[i]) for i in range(len(S))])
b = len(S) - a
print((2 * min(a, b)))

S = eval(input())
stack = []
stack.append(S[0])
for i in range(1, len(S)):
    if len(stack) == 0:
        stack.append(S[i])
        continue
    cube = stack.pop()
    if cube != S[i]:
        continue
    stack.append(cube)
    stack.append(S[i])
print((len(S) - len(stack)))

-a = sum([int(S[i]) for i in range(len(S))]) -b = len(S) - a -print((2 * min(a, b))) +stack = [] +stack.append(S[0]) +for i in range(1, len(S)): +    if len(stack) == 0: +        stack.append(S[i]) +        continue +    cube = stack.pop() +    if cube != S[i]: +        continue +    stack.append(cube) +    stack.append(S[i]) +print((len(S) - len(stack)))