s =str(eval(input()))

a = 0

b = 0

for i in range(len(s)):

    if s[i] == '0':

        a += 1

    else:

        b += 1

print((min(a, b)*2))

s = str(eval(input()))

a = 0

b = 0

for i in range(len(s)):

    if s[i] == '0':

        a += 1

    else:

        b += 1

print((2*min(a, b)))

s = str(eval(input()))
a = 0
b = 0
for i in range(len(s)):
    if s[i] == "0":
        a += 1
    else:
        b += 1
print((min(a, b) * 2))

s = str(eval(input()))
a = 0
b = 0
for i in range(len(s)):
    if s[i] == "0":
        a += 1
    else:
        b += 1
print((2 * min(a, b)))

-print((min(a, b) * 2)) +print((2 * min(a, b)))