s = str(eval(input()))

figure1 = s.count('0')

figure2 = s.count('1')

print((min(figure1, figure2)*2))

s=str(eval(input()))

print((min(s.count('0'),s.count('1'))*2))

s = str(eval(input()))
figure1 = s.count("0")
figure2 = s.count("1")
print((min(figure1, figure2) * 2))

s = str(eval(input()))
print((min(s.count("0"), s.count("1")) * 2))

-figure1 = s.count("0") -figure2 = s.count("1") -print((min(figure1, figure2) * 2)) +print((min(s.count("0"), s.count("1")) * 2))