S = list(eval(input()))

a = S.count("0")

b = S.count("1")

ans = min(a,b)*2

print(ans)
s = eval(input())

n = len(s)

a = s.count('0')

ans = min(a,n-a)*2

print(ans)
S = list(eval(input()))
a = S.count("0")
b = S.count("1")
ans = min(a, b) * 2
print(ans)

s = eval(input())
n = len(s)
a = s.count("0")
ans = min(a, n - a) * 2
print(ans)

-S = list(eval(input())) -a = S.count("0") -b = S.count("1") -ans = min(a, b) * 2 +s = eval(input()) +n = len(s) +a = s.count("0") +ans = min(a, n - a) * 2