s = list(eval(input()))

n = len(s)

for i in range(n):

  s[i] = int(s[i])

ones = sum(s)

zeros = n-sum(s)

print((min(ones,zeros)*2))
s = list(eval(input()))



count0 = 0

count1 = 0

for i in range(len(s)):

  if s[i]=='0': count0 += 1

  if s[i]=='1': count1 += 1

print((min(count0,count1)*2))

s = list(eval(input()))
n = len(s)
for i in range(n):
    s[i] = int(s[i])
ones = sum(s)
zeros = n - sum(s)
print((min(ones, zeros) * 2))

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

-n = len(s) -for i in range(n): -    s[i] = int(s[i]) -ones = sum(s) -zeros = n - sum(s) -print((min(ones, zeros) * 2)) +count0 = 0 +count1 = 0 +for i in range(len(s)): +    if s[i] == "0": +        count0 += 1 +    if s[i] == "1": +        count1 += 1 +print((min(count0, count1) * 2))