s=list(eval(input()))

x=len(s)

from collections import deque

d=deque()



for i in s:

    if len(d)==0:

        d.append(i)

    elif d[-1]!=i:

        d.pop()

    elif d[-1]==i:

        d.append(i)



print((x-len(d)))
s=list(eval(input()))

c0=s.count('0')

c1=s.count("1")

print((min(c0,c1)*2))
s = list(eval(input()))
x = len(s)
from collections import deque

d = deque()
for i in s:
    if len(d) == 0:
        d.append(i)
    elif d[-1] != i:
        d.pop()
    elif d[-1] == i:
        d.append(i)
print((x - len(d)))

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

-x = len(s) -from collections import deque - -d = deque() -for i in s: -    if len(d) == 0: -        d.append(i) -    elif d[-1] != i: -        d.pop() -    elif d[-1] == i: -        d.append(i) -print((x - len(d))) +c0 = s.count("0") +c1 = s.count("1") +print((min(c0, c1) * 2))