s = eval(input())

ans = 0

for i in range(len(s)):

    if s[i] == "0":

        ans -= 1

    else:

        ans += 1

print((len(s) - abs(ans)))

s = list(eval(input()))

cnt = 0

for i in range(len(s)):

    if s[i] == "0":

        cnt += 1

print((min(cnt, len(s)-cnt)*2))

s = eval(input())
ans = 0
for i in range(len(s)):
    if s[i] == "0":
        ans -= 1
    else:
        ans += 1
print((len(s) - abs(ans)))

s = list(eval(input()))
cnt = 0
for i in range(len(s)):
    if s[i] == "0":
        cnt += 1
print((min(cnt, len(s) - cnt) * 2))

-s = eval(input()) -ans = 0 +s = list(eval(input())) +cnt = 0 -        ans -= 1 -    else: -        ans += 1 -print((len(s) - abs(ans))) +        cnt += 1 +print((min(cnt, len(s) - cnt) * 2))