S = input().strip()

N = len(S)

cnt = 0

for i in range(N):

    if S[i]=="1":

        cnt += 1

print((min(cnt,N-cnt)*2))
S = input().strip()

cnt0 = 0

cnt1 = 0

for i in range(len(S)):

    if S[i]=="0":

        cnt0 += 1

    else:

        cnt1 += 1

print((min(cnt0,cnt1)*2))
S = input().strip()
N = len(S)
cnt = 0
for i in range(N):
    if S[i] == "1":
        cnt += 1
print((min(cnt, N - cnt) * 2))

S = input().strip()
cnt0 = 0
cnt1 = 0
for i in range(len(S)):
    if S[i] == "0":
        cnt0 += 1
    else:
        cnt1 += 1
print((min(cnt0, cnt1) * 2))

-N = len(S) -cnt = 0 -for i in range(N): -    if S[i] == "1": -        cnt += 1 -print((min(cnt, N - cnt) * 2)) +cnt0 = 0 +cnt1 = 0 +for i in range(len(S)): +    if S[i] == "0": +        cnt0 += 1 +    else: +        cnt1 += 1 +print((min(cnt0, cnt1) * 2))