EPS/2024/02/12-02-24/b.py

27 lines
495 B
Python
Raw Permalink Normal View History

2024-04-15 13:45:30 +02:00
def solve():
n = int(input())
env = input()
winners_ct = [1]
t = env[0]
ind, k = 1, 1
for i in range(1, len(env)):
new = env[i]
if new == t:
k += 1
winners_ct.append(winners_ct[-1])
else:
winners_ct.append(winners_ct[-1]+k)
k = 1
t = new
return " ".join([str(a) for a in winners_ct])
def main():
count = int(input())
for _ in range(count):
print(solve())
main()