S=eval(input())

#N=int(input())

#H,W=map(int,input().split())

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=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 = eval(input())
# N=int(input())
# H,W=map(int,input().split())
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 = 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))

-# N=int(input()) -# H,W=map(int,input().split()) -print((min([a, b]) * 2)) +print((min(a, b) * 2))