S = list(eval(input()))

n = len(S)

red = S.count("0")

blue = n - red

print((n if red == blue else n - abs(red - blue)))
S = eval(input())

n = len(S)

red = S.count("0")

blue = n - red

print((n if red == blue else min(red, blue) * 2))
S = list(eval(input()))
n = len(S)
red = S.count("0")
blue = n - red
print((n if red == blue else n - abs(red - blue)))

S = eval(input())
n = len(S)
red = S.count("0")
blue = n - red
print((n if red == blue else min(red, blue) * 2))

-S = list(eval(input())) +S = eval(input()) -print((n if red == blue else n - abs(red - blue))) +print((n if red == blue else min(red, blue) * 2))