N = eval(input())



A = []

for i in N:

    A.append(i)



cnt = 0

j = 0

while len(A) >= 2 and len(A)-1 > j:

    if A[j] != A[j+1]:

        cnt = cnt + 2    

        del A[j]

        del A[j]

        if j != 0:

            j -= 1

    else:

        j += 1



print(cnt)
N = eval(input())



num0 = 0

num1 = 0

for i in N:

    if i == '0':

        num0 = num0 + 1

    else:

        num1 = num1 + 1



print((2*min(num0,num1)))
N = eval(input())
A = []
for i in N:
    A.append(i)
cnt = 0
j = 0
while len(A) >= 2 and len(A) - 1 > j:
    if A[j] != A[j + 1]:
        cnt = cnt + 2
        del A[j]
        del A[j]
        if j != 0:
            j -= 1
    else:
        j += 1
print(cnt)

N = eval(input())
num0 = 0
num1 = 0
for i in N:
    if i == "0":
        num0 = num0 + 1
    else:
        num1 = num1 + 1
print((2 * min(num0, num1)))

-A = [] +num0 = 0 +num1 = 0 -    A.append(i) -cnt = 0 -j = 0 -while len(A) >= 2 and len(A) - 1 > j: -    if A[j] != A[j + 1]: -        cnt = cnt + 2 -        del A[j] -        del A[j] -        if j != 0: -            j -= 1 +    if i == "0": +        num0 = num0 + 1 -        j += 1 -print(cnt) +        num1 = num1 + 1 +print((2 * min(num0, num1)))