Little09 and his friends are playing a game. There are $n$ players, and the temperature value of the player $i$ is $i$.

The types of environment are expressed as $0$ or $1$. When two players fight in a specific environment, if its type is $0$, the player with a lower temperature value in this environment always wins; if it is $1$, the player with a higher temperature value in this environment always wins. The types of the $n-1$ environments form a binary string $s$ with a length of $n-1$.

If there are $x$ players participating in the game, there will be a total of $x-1$ battles, and the types of the $x-1$ environments will be the first $x-1$ characters of $s$. While there is more than one player left in the tournament, choose any two remaining players to fight. The player who loses will be eliminated from the tournament. The type of the environment of battle $i$ is $s_i$.

For each $x$ from $2$ to $n$, answer the following question: if all players whose temperature value does not exceed $x$ participate in the game, how many players have a chance to win?


-----Input-----

Each test contains multiple test cases. The first line contains a single integer $t$ ($1\le t \le 10^3$)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($2\leq n\leq 2\cdot 10^5$)  — the number of players.

The second line of each test case contains a binary string $s$ with a length $n-1$.

It is guaranteed that the sum of $n$ over all test cases does not exceed $3\cdot 10^5$.


-----Output-----

For each test case output $n-1$ integers  — for each $x$ from $2$ to $n$, output the number of players that have a chance to win.


-----Examples-----

Input
2
4
001
4
101
Output
1 1 3 
1 2 3


-----Note-----

In the first test case, for $x=2$ and $x=3$, only the player whose temperature value is $1$ can be the winner. For $x=4$, the player whose temperature value is $2,3,4$ can be the winner.

Difficulty: EASY
Tags: Greedy algorithms

Dynamic programming

Constructive algorithms
Skill types: Dynamic programming

Greedy algorithms

Starter code:

Solutions:
t = int(input())
result = []
for i in range(t):
	n = int(input())
	s = input()
	r = ['1']
	for j in range(2, n):
		if s[j - 2] == s[j - 1]:
			r.append(r[-1])
		else:
			r.append(str(j))
	result.append(' '.join(r))
for i in result:
	print(i)


def solve():
	n = int(input())
	s = input()
	ans = [1]
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			ans.append(ans[-1])
		else:
			ans.append(i + 1)
	print(' '.join([str(i) for i in ans]))
t = int(input())
for i in range(t):
	solve()


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	(l, r) = (1, 1)
	i = 1
	ans = []
	for v in inp().strip():
		i += 1
		if v == '0':
			l = 1
		else:
			r = i
			l += 1
		ans.append(str(r - l + 1))
	print(' '.join(ans))

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = s[0]
	b = 1
	d = 1
	nums = []
	for k in s:
		d += 1
		if a == k:
			nums.append(b)
		else:
			b = d - 1
			a = k
			nums.append(b)
	print(' '.join((str(e) for e in nums)))


for i in range(int(input())):
	n = int(input())
	s = input()
	a = '1 '
	last = '1'
	for j in range(1, n - 1):
		if s[j - 1] != s[j]:
			last = str(j + 1)
		a += last + ' '
	print(a[:-1])


import sys

def fn(b):
	prev = b[0]
	count = 1
	output = '1 '
	for i in range(1, len(b)):
		if b[i] == prev:
			count += 1
		else:
			count = 1
		prev = b[i]
		output += str(i + 2 - count) + ' '
	return output[:-1]
input = sys.stdin.readlines()
t = int(input[0].strip('\n'))
for i in range(t):
	input_string = input[2 * i + 2].strip('\n')
	print(fn(input_string))


def solve(n, s):
	results = [1]
	streak = 0
	for x in range(2, n):
		if s[x - 1] == s[x - 2]:
			streak += 1
		else:
			streak = 0
		results.append(x - streak)
	return ' '.join((str(c) for c in results))
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print(solve(n, s))


amount = int(input())
for a in range(amount):
	n = int(input())
	environments = input()
	possibilities_players = ''
	consecutive = 0
	last = environments[0]
	for (count1, a2) in enumerate(environments):
		if last == a2:
			consecutive += 1
		else:
			last = a2
			consecutive = 1
		possibilities_players += f'{count1 + 2 - consecutive} '
	print(possibilities_players)


t = int(input())
while t:
	n = int(input())
	s = input()
	x = 1
	a = s[0]
	z = ''
	for c in range(len(s)):
		if a != s[c]:
			x = c + 1
			a = s[c]
		z += ' ' + str(x)
	print(z[1:])
	t -= 1


def N():
	return int(input())

def A():
	return [int(x) for x in input().split()]

def S():
	return input()
for _ in range(N()):
	a = [1]
	n = N() - 1
	if 'codeforces' == 28226329:
		print('Tanmay')
	ans = ''
	s = S()
	for i in range(1, n):
		if s[i] == s[i - 1]:
			a.append(a[-1])
			continue
		a.append(i + 1)
	for i in a:
		ans += str(i) + ' '
	print(ans)


t = int(input())
for t_ in range(t):
	n = int(input())
	s = input()
	ans = ''
	a = 1
	b = 1
	for x in range(n - 1):
		if s[x] == '0':
			a = 1
		else:
			a += 1
			b = x + 2
		ans += str(b - a + 1) + ' '
	print(ans)


roll = int(input())
for ink in range(roll):
	mass = int(input())
	b = input()
	vals = [1]
	for i in range(1, len(b)):
		if b[i] == b[i - 1]:
			vals.append(vals[i - 1])
		else:
			vals.append(i + 1)
	ans = ''
	for i in range(len(vals) - 1):
		ans += str(vals[i]) + ' '
	ans += str(vals[len(vals) - 1])
	print(ans)


def ice_fire(n, s):
	dp = [1] * len(s)
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			dp[i] = dp[i - 1]
		else:
			dp[i] = i + 1
	return dp
for i in range(int(input())):
	n = int(input())
	s = input()
	l = ice_fire(n, s)
	print(*l)


G = int
F = range
D = input
for H in F(G(D())):
	E = G(D())
	C = D()
	A = [1]
	for B in F(1, E - 1):
		if C[B] != C[B - 1]:
			A.append(B + 1)
		else:
			A.append(A[-1])
	print(*A)


for _ in range(int(input())):
	n = int(input())
	s = input()
	vls = [1]
	for i in range(n - 2):
		if s[i] == s[i + 1]:
			vls.append(vls[-1])
		else:
			vls.append(i + 2)
	print(*vls)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = [1]
	temp = s[0]
	for i in range(1, n - 1):
		if s[i] != temp:
			l.append(i + 1)
		else:
			l.append(l[-1])
		temp = s[i]
	print(*l)


t = int(input())
for tes in range(t):
	a = []
	n = int(input())
	s = input()
	ans = 1
	a.append(1)
	for i in range(1, n - 1):
		if s[i] != s[i - 1]:
			ans = i + 1
		a.append(ans)
	print(*a)


for _ in ' ' * int(input()):
	n = int(input())
	s = input()
	a = [1] + [0] * (n - 1)
	for i in range(1, n - 1):
		if s[i] != s[i - 1]:
			a[i] = i + 1
		else:
			a[i] = a[i - 1]
	print(*a[:-1])


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(input())
	s = input()
	ans = []
	for j in range(len(s)):
		if j == 0:
			ans.append(1)
		elif s[j] == s[j - 1]:
			ans.append(ans[-1])
		else:
			ans.append(j + 1)
	print(*ans)


import sys

def parse():
	t = int(sys.stdin.readline())
	for _ in range(t):
		n = int(sys.stdin.readline())
		input_str = sys.stdin.readline().rstrip()
		ones_in_a_row = 0
		zeros_in_a_row = 0
		for (i, char) in enumerate(input_str):
			if char == '0':
				print(i + 1 - zeros_in_a_row, end=' ')
				zeros_in_a_row += 1
				ones_in_a_row = 0
			else:
				print(i + 1 - ones_in_a_row, end=' ')
				ones_in_a_row += 1
				zeros_in_a_row = 0
		print()
parse()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	dp = [1] * len(s)
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			dp[i] = i + 1
		else:
			dp[i] = dp[i - 1]
	print(*dp)


n = int(input())
for i in range(n):
	t = int(input())
	s = str(input())
	fg = s[0]
	f1 = 1
	f2 = 1
	ans = []
	for i in s:
		f2 += 1
		if fg == i:
			ans.append(f1)
		else:
			f1 = f2 - 1
			fg = i
			ans.append(f1)
	print(*ans)


for i in range(int(input())):
	n = int(input())
	a = input()
	x = 1
	c = 1
	l = [1]
	for i in range(n - 2):
		if a[i] == a[i + 1]:
			c += 1
			l.append(x)
		else:
			x += c
			l.append(x)
			c = 1
	print(*l)


import sys
import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	l = [1]
	for i in range(1, n - 1):
		if s[i] != s[i - 1]:
			l.append(len(l) + 1)
		else:
			l.append(l[i - 1])
	print(*l)


for _ in range(int(input())):
	n = int(input())
	a = input()
	last = 1
	print(1, end=' ')
	for i in range(1, n - 1):
		if a[i] != a[i - 1]:
			last = i + 1
		print(last, end=' ')
	print()


import math
import collections
import bisect
import heapq
from collections import deque
from math import sqrt, ceil, floor

def inp_arr():
	return list(map(int, input().strip().split(' ')))

def inp_str_arr():
	return list(input().strip().split(' '))

def inp_str():
	return input()

def solve():
	(n,) = inp_arr()
	s = inp_str()
	ans = []
	cnt = 1
	last = '-1'
	sm = 0
	for x in s:
		if last != x:
			sm += cnt
			ans.append(sm)
			cnt = 1
			last = x
		else:
			ans.append(sm)
			cnt += 1
	for x in ans:
		print(x, end=' ')
	print('')
(tt,) = inp_arr()
for t in range(tt):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = s[0]
	c = 1
	b = 1
	ans = []
	for i in range(n - 1):
		c += 1
		if a != s[i]:
			a = s[i]
			b = c - 1
			ans.append(b)
		else:
			ans.append(b)
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = [1]
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			ans.append(ans[-1])
		else:
			ans.append(i + 1)
	print(*ans, sep=' ')


g = int
f = range
d = input
for h in f(g(d())):
	e = g(d())
	c = d()
	a = [1]
	for b in f(1, e - 1):
		if c[b] != c[b - 1]:
			a.append(b + 1)
		else:
			a.append(a[-1])
	print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	prev = 1
	print(1, end=' ')
	for i in range(1, n - 1):
		if s[i] != s[i - 1]:
			prev = i + 1
		print(prev, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	s = str(input())
	(a, b) = (1, 1)
	c = s[0]
	for i in range(len(s)):
		b += 1
		if s[i] == c:
			print(a, end=' ')
		else:
			a = b - 1
			c = s[i]
			print(a, end=' ')
	print('')


t = int(input())
for k in range(t):
	n = int(input())
	s = input()
	l = []
	res = []
	dp = []
	aux = ''
	for i in range(n):
		l.append(i + 1)
	for i in range(n - 1):
		if i == 0:
			aux = s[0]
			res.append(1)
			dp.append(1)
		elif s[i] == aux:
			dp.append(dp[i - 1] + 1)
			res.append(i + 2 - dp[i])
		else:
			aux = s[i]
			dp.append(1)
			res.append(i + 1)
	sres = ''
	for i in range(n - 1):
		if i != n - 2:
			sres += str(res[i]) + ' '
		else:
			sres += str(res[i])
	print(sres)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	arr = [0 for i in range(n)]
	last_c = arr[0]
	total = 1
	result = 1
	for c in s:
		total += 1
		if last_c != c:
			result = total - 1
			last_c = c
		print(result, end=' ')
	print()


import sys
import math
from bisect import bisect_right as br
from collections import deque
from itertools import combinations as cb

def int_arr():
	return list(map(int, sys.stdin.readline().strip().split()))

def str_arr():
	return list(map(str, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	st = input()
	ans = 1
	print(1, end=' ')
	for i in range(1, n - 1):
		if st[i] == st[i - 1]:
			print(ans, end=' ')
		else:
			ans = i + 1
			print(ans, end=' ')
	print()


test = int(input())
for tes in range(test):
	n = int(input())
	A = input()
	P = []
	a = 1
	b = 1
	c = A[0]
	for i in range(n - 1):
		a += 1
		if c == A[i]:
			P.append(b)
		else:
			b = a - 1
			c = A[i]
			P.append(b)
	print(*P)


def solve():
	n = int(input())
	s = input()
	lz = 0
	lo = 0
	for i in range(n - 1):
		if s[i] == '0':
			lz = i + 1
			print(lo + 1, end=' ')
		else:
			lo = i + 1
			print(lz + 1, end=' ')
	print()
t = int(input())
for _ in range(t):
	solve()


for t in range(int(input())):
	n = int(input())
	s = input()
	m = len(s)
	x = 1
	y = 0
	for i in range(1, m):
		print(x, end=' ')
		if s[i] == s[i - 1]:
			y += 1
		else:
			x = x + y + 1
			y = 0
	print(x)


import math
import sys
for cf_mc_tt in range(int(input())):
	cf_mc_nn = int(input())
	cf_mc_ll = input()
	ans1 = cf_mc_ll[0]
	ans2 = []
	x1 = 0
	for ii in range(0, cf_mc_nn - 1):
		if cf_mc_ll[ii] == ans1:
			x1 += 1
		else:
			x1 = 1
			ans1 = cf_mc_ll[ii]
		ans2.append(2 + ii - x1)
	print(*ans2)


t = int(input())
for j in range(t):
	n = int(input())
	arr = input()
	string = arr[0]
	value = 1
	update = 1
	for i in range(n - 1):
		update += 1
		if string == arr[i]:
			print(value, end=' ')
		else:
			value = update - 1
			string = arr[i]
			print(value, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	a = input()
	x = 1
	c = 1
	print(1, end=' ')
	for i in range(n - 2):
		if a[i] == a[i + 1]:
			c += 1
			print(x, end=' ')
		else:
			x += c
			print(x, end=' ')
			c = 1
	print()


def solve():
	n = int(input())
	s = list(map(int, list(input())))
	ps = [0, 0]
	for i in range(len(s)):
		ps[s[i]] = i + 1
		if s[i]:
			print(ps[0] + 1, end=' ')
		else:
			print(ps[1] + 1, end=' ')
T = int(input())
for _ in range(T):
	solve()
	print()


t = int(input(''))
for i in range(t):
	n = int(input(''))
	s = input()
	print('1', end=' ')
	p = 1
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			print(p, end=' ')
		else:
			p = i + 1
			print(p, end=' ')
	print()


t = int(input())
while t:
	n = int(input())
	s = input()
	(f, x) = (1, 1)
	c = s[0]
	for i in s:
		f += 1
		if c != i:
			x = f - 1
			c = i
		print(x, end=' ')
	print()
	t -= 1


t = int(input())
for _ in range(0, t):
	n = int(input())
	s = str(input())
	print(1, end=' ')
	counter = 1
	prev = s[0]
	for i in range(1, n - 1):
		if prev == s[i]:
			counter += 1
			print(i + 2 - counter, end=' ')
		else:
			counter = 1
			prev = s[i]
			print(i + 1, end=' ')
	print()


tests = int(input())
for i in range(tests):
	n = int(input())
	string = input()
	last_char = '#'
	char_count = 1
	for j in range(n - 1):
		possible = j + 1
		if last_char != string[j]:
			last_char = string[j]
			char_count = 1
			print(possible, end=' ')
		else:
			print(possible - char_count, end=' ')
			char_count += 1
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = [ord(i) - ord('0') for i in input()]
	b = s[0]
	ans = [1]
	for i in range(1, n - 1):
		if s[i] == b:
			ans.append(ans[i - 1])
		else:
			ans.append(i + 1)
		b = s[i]
	print(*ans)


N = int(input())

def solve():
	p = [0, 0]
	n = int(input())
	a = tuple(map(int, input()))
	ans = []
	for i in range(1, n - 1):
		p[a[i - 1]] = i
		if a[i - 1] == 0:
			print(p[1] + 1, end=' ')
		else:
			print(p[0] + 1, end=' ')
	p[a[n - 2]] = n - 1
	if a[n - 2] == 0:
		print(p[1] + 1, end='\n')
	else:
		print(p[0] + 1, end='\n')

def main():
	for i in range(N):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	(res, zeros, ones) = ([], 0, 0)
	for (i, char) in enumerate(s):
		if char == '0':
			zeros += 1
			ones = 0
		else:
			ones += 1
			zeros = 0
		res.append(i + 2 - zeros - ones)
	print(*res)


mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : str(input())
ni = lambda : int(input())
for _ in range(int(input())):
	n = ni()
	s = si()
	ans = [1]
	found = False
	last = 1
	for i in range(1, n - 1):
		if s[i] != s[i - 1]:
			last = 0
		ans.append(i + 1 - last)
		last += 1
	print(*ans)


import math
iter = int(input())
for _ in range(iter):
	n = int(input())
	s = input()
	cons = 1
	ans = [0] * (n - 1)
	ans[0] = 1
	for i in range(3, n + 1):
		if s[i - 2] == s[i - 3]:
			cons += 1
		else:
			cons = 1
		ans[i - 2] = i - cons
	print(*ans)


from collections import defaultdict
d = defaultdict(list)
for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = [0] * (n - 1)
	ans[0] = 1
	for i in range(1, n - 1):
		if s[i] == s[i - 1]:
			ans[i] = ans[i - 1]
		else:
			ans[i] = i + 1
	for k in ans:
		print(k, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	count = 0
	z = 0
	o = 0
	for j in range(n - 1):
		if s[j] == '0':
			z += 1
			print(j + 2 - z, end=' ')
			o = 0
		else:
			o += 1
			print(j + 2 - o, end=' ')
			z = 0
	print()


I = input
for i in ' ' * int(I()):
	m = int(I())
	b = I()
	d = 0
	print(1, end=' ')
	for j in range(1, m - 1):
		if b[j] == b[j - 1]:
			d += 1
		else:
			d = 0
		print(j + 1 - d, end=' ')
	print(' ')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	last = None
	contig = 0
	for i in range(len(s)):
		if s[i] == last:
			contig += 1
		else:
			contig = 1
			last = s[i]
		print(i + 2 - contig, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	line = input()
	count = 1
	last = 0
	for i in range(n - 1):
		if last == line[i]:
			count += 1
		else:
			count = 1
		last = line[i]
		print(i + 2 - count, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	s = input()
	print(1, end=' ')
	cnt = 1
	for x in range(1, n - 1):
		if s[x] == s[x - 1]:
			cnt += 1
		else:
			cnt = 1
		print(x - cnt + 2, end=' ')
	print()


kol = int(input())
for j in range(0, kol):
	n = int(input())
	s = str(input())
	count = 0
	ans = ''
	count = 1
	y = s[0]
	ncount = 0
	for i in range(0, n - 1):
		ncount = ncount + 1
		if y != s[i]:
			count = ncount
			y = s[i]
		print(str(count), end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(1, end=' ')
	c = 1
	for i in range(n - 2):
		a = s[i]
		b = s[i + 1]
		if a == '0' and b == '0':
			print(c, end=' ')
		elif a == '1' and b == '1':
			print(c, end=' ')
		else:
			print(i + 2, end=' ')
			c = i + 2
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	j = 2
	p = 0
	L = '3'
	for i in s:
		if i == L:
			p += 1
		else:
			p = 1
		L = i
		print(j - p, end=' ')
		j += 1
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = 0
	for i in range(2, n + 1):
		if s[i - 2] == '1':
			if a < 0:
				a = 0
			a += 1
		else:
			if a > 0:
				a = 0
			a -= 1
		print(i - abs(a), end=' ')
	print()


t = int(input())
for i in range(t):
	x = int(input())
	arr = input()
	c = 0
	temp = 1
	prev = arr[0]
	for j in arr:
		temp += 1
		if j == prev:
			c += 1
		else:
			c = 1
			prev = j
		print(temp - c, end=' ')
	print()


t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	dub = [0, s[0]]
	ans = []
	for i in range(n - 1):
		if s[i] == dub[1]:
			c = dub[0] + 1
			dub[0] = c
			ans.append(i + 2 - dub[0])
		else:
			dub = [0, s[i]]
			if s[i] == dub[1]:
				c = dub[0] + 1
				dub[0] = c
				ans.append(i + 2 - dub[0])
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	acc = []
	value = 0
	for i in s:
		if i == '1':
			value = value + 1 if value > 0 else 1
			acc.append(value)
		else:
			value = value - 1 if value < 0 else -1
			acc.append(value)
	for (x, l) in enumerate(acc):
		print(x + 2 - abs(l), end=' ')
	print()


for i in range(int(input())):
	a = int(input())
	b = input()
	ans = 1
	currlen = 2
	counto = 0
	count1 = 0
	for j in range(len(b)):
		if j == 0:
			print(ans, end=' ')
			currlen += 1
			continue
		if b[j] != b[j - 1]:
			ans = currlen - 1
		print(ans, end=' ')
		currlen += 1
	print()


for j in range(int(input())):
	n = int(input())
	s = input()
	a = []
	for i in s:
		a.append(int(i))
	t = 1
	print(t, end=' ')
	for i in range(1, len(a)):
		if a[i - 1] != a[i]:
			print(i + 1, end=' ')
			t = i + 1
		else:
			print(t, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print(1, end=' ')
	ctn = 1
	for i in range(1, n - 1):
		if s[i - 1] == s[i]:
			print(ctn, end=' ')
		else:
			print(i + 1, end=' ')
			ctn = i + 1
	print()


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, list(input())))
	ps = [0, 0]
	for i in range(1, n):
		ps[s[i - 1]] = i
		if s[i - 1] == 0:
			print(ps[1] + 1, end=' ')
		else:
			print(ps[0] + 1, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	one = False
	zero = False
	last = None
	contig = 0
	for i in range(len(s)):
		if int(s[i]):
			one = True
		else:
			zero = True
		if s[i] == last:
			contig += 1
		else:
			contig = 1
			last = s[i]
		if one and zero:
			print(i + 2 - contig, end=' ')
		else:
			print(1, end=' ')
	print()


import sys
input = sys.stdin.readline

def readList():
	return list(map(int, input().split()))

def readInt():
	return int(input())

def readInts():
	return map(int, input().split())

def readStr():
	return input().strip()

def solve():
	n = readInt()
	S = readStr()
	cnt = [0, 0]
	cont = [0, 0]
	ans = []
	prev = -1
	for i in range(n - 1):
		idx = int(S[i])
		if idx == prev:
			cont[idx] += 1
		else:
			cont[idx] = 1
			cont[idx ^ 1] = 0
			prev = idx
		val = 1
		val += i - max(cont[idx] - 1, 0)
		ans.append(val)
	return ans
for _ in range(int(input())):
	print(*solve())


import math
for u in range(int(input())):
	k = int(input())
	s = input()
	x = [0]
	i = 0
	q = 0
	while q < k - 1:
		c = x[-1]
		if s[i] == s[q]:
			c = c + 1
			x.append(c)
			q = q + 1
		else:
			i = q
			q = q + 1
			x.append(1)
	x = x[1:]
	l = []
	for i in range(k - 1):
		l.append(i + 2 - x[i])
	print(*l)


t = int(input())
while t > 0:
	n = int(input())
	s = input()
	s = '0' + s
	ps = [0, 0]
	for i in range(1, n):
		curr = s[i]
		ps[int(curr)] = i
		if curr == '0':
			print(ps[1] + 1, end=' ')
		else:
			print(ps[0] + 1, end=' ')
	print()
	t -= 1


for tc in range(int(input())):
	n = int(input())
	s = input()
	curr = s[0]
	c = 1
	cos = [1]
	res = [1]
	for i in range(1, n - 1):
		if s[i] == curr:
			c += 1
			cos.append(c)
			curr = s[i]
		else:
			c = 1
			cos.append(1)
			curr = s[i]
	for i in range(1, n - 1):
		res.append(i - cos[i] + 2)
	for i in res:
		print(i, end=' ')
	print()


t = int(input())
for i in range(0, t):
	n = int(input())
	a = input()
	l = [0] * n
	l[0] = 1
	count = 0
	print(1, end=' ')
	for j in range(1, n - 1):
		if a[j] == a[j - 1]:
			count = count + 1
			l[j] = l[j - 1]
		else:
			l[j] = l[j - 1] + count + 1
			count = 0
		print(l[j], end=' ')
	print('')


t = int(input())
for ole in range(t):
	n = int(input())
	s = input()
	(zero, one) = (0, 0)
	prev = 1
	if ole != 0:
		print()
	for i in range(n - 1):
		count = 1
		if i != 0:
			curr = s[i - 1]
		if s[i] == '0':
			zero += 1
		else:
			one += 1
		if one == 0 or zero == 0:
			print(count, end=' ')
		elif curr == s[i]:
			print(prev, end=' ')
		else:
			prev = i + 1
			print(prev, end=' ')


import math
for _ in range(int(input())):
	n = int(input())
	s = input()
	x = [0]
	i = 0
	j = 0
	while j < n - 1:
		c = x[-1]
		if s[i] == s[j]:
			c = c + 1
			x.append(c)
			j = j + 1
		else:
			i = j
			j = j + 1
			x.append(1)
	x = x[1:]
	l = []
	for i in range(n - 1):
		l.append(i + 2 - x[i])
	print(*l)


for j in range(int(input())):
	har = int(input())
	num = list(input())
	for i in range(har - 1):
		num[i] = int(num[i])
	ans = 0
	for i in range(har - 1):
		if i == 0 or num[i] == num[i - 1]:
			ans += 1
		else:
			ans = 1
		print(i + 2 - ans, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	num = list(input())
	for i in range(n - 1):
		num[i] = int(num[i])
	ans = 0
	for i in range(n - 1):
		if i == 0 or num[i] == num[i - 1]:
			ans += 1
		else:
			ans = 1
		print(i + 2 - ans, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	s = input()
	s0 = 0
	s1 = 0
	print(1, end=' ')
	c = 1
	for i in range(1, n - 1):
		s0 += 1 - int(s[i])
		s1 += int(s[i])
		if s[i] == s[i - 1]:
			print(c, end=' ')
		else:
			c = i + 1
			print(c, end=' ')
	print()