s=eval(input())

a=0

b=0



for i in s:

		if i=="0":

			a+=1

		else:

			b+=1

				

print((min(a,b)*2))
S=eval(input())

stack=[]

cnt=0



for s in S:

  if not stack:

    stack.append(s)

  elif stack[-1]!=s:

      stack.pop()

      cnt+=2

  else:

    stack.append(s)

print(cnt)
s = eval(input())
a = 0
b = 0
for i in s:
    if i == "0":
        a += 1
    else:
        b += 1
print((min(a, b) * 2))

S = eval(input())
stack = []
cnt = 0
for s in S:
    if not stack:
        stack.append(s)
    elif stack[-1] != s:
        stack.pop()
        cnt += 2
    else:
        stack.append(s)
print(cnt)

-s = eval(input()) -a = 0 -b = 0 -for i in s: -    if i == "0": -        a += 1 +S = eval(input()) +stack = [] +cnt = 0 +for s in S: +    if not stack: +        stack.append(s) +    elif stack[-1] != s: +        stack.pop() +        cnt += 2 -        b += 1 -print((min(a, b) * 2)) +        stack.append(s) +print(cnt)