s = eval(input())

cnt = 0

idx = 1

tmp = ''

hit = True

while(hit):

	hit = False

	for i in range(idx, len(s)):

		if s[i-1:i+1] == '01' or s[i-1:i+1] == '10':

			tmp = s[0:i-1] + s[i+1: ]

			cnt += 2

			idx = i - 1 if i > 1 else 1

			hit = True

			s = tmp

			break

            

print (cnt)
s = eval(input())

cnt0 = s.count('0')

cnt1 = s.count('1')

print((min(cnt0, cnt1) * 2))
s = eval(input())
cnt = 0
idx = 1
tmp = ""
hit = True
while hit:
    hit = False
    for i in range(idx, len(s)):
        if s[i - 1 : i + 1] == "01" or s[i - 1 : i + 1] == "10":
            tmp = s[0 : i - 1] + s[i + 1 :]
            cnt += 2
            idx = i - 1 if i > 1 else 1
            hit = True
            s = tmp
            break
print(cnt)

s = eval(input())
cnt0 = s.count("0")
cnt1 = s.count("1")
print((min(cnt0, cnt1) * 2))

-cnt = 0 -idx = 1 -tmp = "" -hit = True -while hit: -    hit = False -    for i in range(idx, len(s)): -        if s[i - 1 : i + 1] == "01" or s[i - 1 : i + 1] == "10": -            tmp = s[0 : i - 1] + s[i + 1 :] -            cnt += 2 -            idx = i - 1 if i > 1 else 1 -            hit = True -            s = tmp -            break -print(cnt) +cnt0 = s.count("0") +cnt1 = s.count("1") +print((min(cnt0, cnt1) * 2))