S = eval(input())

a = []

for s in S:

    if not a:

        a.append(s)

        continue

    if s != a[-1]:

        a.pop()

    else:

        a.append(s)

print((len(S)-len(a)))
s = eval(input())

a = s.count('0')

b = len(s) - a

print((min(a,b)*2))
S = eval(input())
a = []
for s in S:
    if not a:
        a.append(s)
        continue
    if s != a[-1]:
        a.pop()
    else:
        a.append(s)
print((len(S) - len(a)))

s = eval(input())
a = s.count("0")
b = len(s) - a
print((min(a, b) * 2))

-S = eval(input()) -a = [] -for s in S: -    if not a: -        a.append(s) -        continue -    if s != a[-1]: -        a.pop() -    else: -        a.append(s) -print((len(S) - len(a))) +s = eval(input()) +a = s.count("0") +b = len(s) - a +print((min(a, b) * 2))