S = eval(input())

count = [0, 0]

for x in S:

    count[int(x)] += 1



print((min(count)*2))

d = dict()

d['0'] = 0

d['1'] = 0



S = eval(input())



for x in S:

    d[x] += 1

print((min(d['0'], d['1'])*2))

S = eval(input())
count = [0, 0]
for x in S:
    count[int(x)] += 1
print((min(count) * 2))

d = dict()
d["0"] = 0
d["1"] = 0
S = eval(input())
for x in S:
    d[x] += 1
print((min(d["0"], d["1"]) * 2))

+d = dict() +d["0"] = 0 +d["1"] = 0 -count = [0, 0] -    count[int(x)] += 1 -print((min(count) * 2)) +    d[x] += 1 +print((min(d["0"], d["1"]) * 2))