S = list(map(str, input().strip()))

num_of_zero = S.count('0')

num_of_one = S.count('1')

if num_of_zero <=  num_of_one:

    delete_num = 2 * num_of_zero

else:

    delete_num = 2 * num_of_one

print(delete_num)
S = eval(input())

N = len(S)

num_one = S.count('1')

num_zero = S.count('0')

print((N - abs(num_one - num_zero)))

S = list(map(str, input().strip()))
num_of_zero = S.count("0")
num_of_one = S.count("1")
if num_of_zero <= num_of_one:
    delete_num = 2 * num_of_zero
else:
    delete_num = 2 * num_of_one
print(delete_num)

S = eval(input())
N = len(S)
num_one = S.count("1")
num_zero = S.count("0")
print((N - abs(num_one - num_zero)))

-S = list(map(str, input().strip())) -num_of_zero = S.count("0") -num_of_one = S.count("1") -if num_of_zero <= num_of_one: -    delete_num = 2 * num_of_zero -else: -    delete_num = 2 * num_of_one -print(delete_num) +S = eval(input()) +N = len(S) +num_one = S.count("1") +num_zero = S.count("0") +print((N - abs(num_one - num_zero)))