S = input().strip()

N = len(S)

k = 0

for i in range(N):

    if S[i]=="0":

        k += 1

m = min(k,N-k)

print((2*m))
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()
N = len(S)
k = 0
for i in range(N):
    if S[i] == "0":
        k += 1
m = min(k, N - k)
print((2 * m))

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))

-k = 0 +cnt = 0 -    if S[i] == "0": -        k += 1 -m = min(k, N - k) -print((2 * m)) +    if S[i] == "1": +        cnt += 1 +print((min(cnt, N - cnt) * 2))