S = eval(input())

S_list = list(S)

a = S_list.count('0')

b = S_list.count('1')

print((len(S_list) - abs(a - b)))
s=eval(input())

print((min(s.count('0'),s.count('1'))*2))
S = eval(input())
S_list = list(S)
a = S_list.count("0")
b = S_list.count("1")
print((len(S_list) - abs(a - b)))

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

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