s = eval(input())

0



count_0 = 0

count_1 = 0

for i in range(len(s)):

    if s[i] == '0':

        count_0 += 1

    else:

        count_1 += 1



print((min(count_0,count_1) * 2))

s = eval(input())



count_0 = 0

count_1 = 0

for i in range(len(s)):

    if s[i] == '0':

        count_0 += 1

    else:

        count_1 += 1



print((min(count_0,count_1) * 2))

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

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

-0