S = eval(input())

one = 0

zero = 0

for i in S:

    if i == "1":

        one += 1

    else:

        zero += 1

print((min(one,zero)*2))
S = eval(input())

cnt_0 = 0

cnt_1 = 0

for i in S:

    if i == "0":

        cnt_0 += 1

    else:

        cnt_1 +=1

print((min(cnt_0,cnt_1)*2))
S = eval(input())
one = 0
zero = 0
for i in S:
    if i == "1":
        one += 1
    else:
        zero += 1
print((min(one, zero) * 2))

S = eval(input())
cnt_0 = 0
cnt_1 = 0
for i in S:
    if i == "0":
        cnt_0 += 1
    else:
        cnt_1 += 1
print((min(cnt_0, cnt_1) * 2))

-one = 0 -zero = 0 +cnt_0 = 0 +cnt_1 = 0 -    if i == "1": -        one += 1 +    if i == "0": +        cnt_0 += 1 -        zero += 1 -print((min(one, zero) * 2)) +        cnt_1 += 1 +print((min(cnt_0, cnt_1) * 2))