There are $n + 1$ cities, numbered from $0$ to $n$. $n$ roads connect these cities, the $i$-th road connects cities $i - 1$ and $i$ ($i \in [1, n]$).

Each road has a direction. The directions are given by a string of $n$ characters such that each character is either L or R. If the $i$-th character is L, it means that the $i$-th road initially goes from the city $i$ to the city $i - 1$; otherwise it goes from the city $i - 1$ to the city $i$.

A traveler would like to visit as many cities of this country as possible. Initially, they will choose some city to start their journey from. Each day, the traveler must go from the city where they currently are to a neighboring city using one of the roads, and they can go along a road only if it is directed in the same direction they are going; i. e., if a road is directed from city $i$ to the city $i + 1$, it is possible to travel from $i$ to $i + 1$, but not from $i + 1$ to $i$. After the traveler moves to a neighboring city, all roads change their directions to the opposite ones. If the traveler cannot go from their current city to a neighboring city, their journey ends; it is also possible to end the journey whenever the traveler wants to.

The goal of the traveler is to visit as many different cities as possible (they can visit a city multiple times, but only the first visit is counted). For each city $i$, calculate the maximum number of different cities the traveler can visit during exactly one journey if they start in the city $i$.


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases.

Each test case consists of two lines. The first line contains one integer $n$ ($1 \le n \le 3 \cdot 10^5$). The second line contains the string $s$ consisting of exactly $n$ characters, each character is either L or R.

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


-----Output-----

For each test case, print $n + 1$ integers. The $i$-th integer should be equal to the maximum number of different cities the traveler can visit during one journey if this journey starts in the $i$-th city.


-----Examples-----

Input
2
6
LRRRLL
3
LRL
Output
1 3 2 3 1 3 2
1 4 1 4


-----Note-----

None

Difficulty: MEDIUM_HARD
Tags: Spanning trees

Dynamic programming

Graph traversal

Implementation
Skill types: Dynamic programming

Starter code:

Solutions:
import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_left
from math import gcd, log, ceil
from collections import Counter
from pprint import pprint

def main():
	n = int(input())
	s = input()
	bl = [0] * (n + 1)
	br = [0] * (n + 1)
	if s[0] == 'L':
		bl[1] = 1
	for i in range(2, n + 1):
		if s[i - 1] == 'L':
			if s[i - 2] == 'R':
				bl[i] = 2 + bl[i - 2]
			else:
				bl[i] = 1
	if s[n - 1] == 'R':
		br[n - 1] = 1
	for i in range(n - 2, -1, -1):
		if s[i] == 'R':
			if s[i + 1] == 'L':
				br[i] = 2 + br[i + 2]
			else:
				br[i] = 1
	ans = [0] * (n + 1)
	for i in range(n + 1):
		ans[i] = bl[i] + br[i] + 1
	print(*ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	pref = [[0, 0] for i in range(n + 1)]
	for i in range(1, n + 1):
		if s[i - 1] == 'R':
			pref[i][0] = 0
			pref[i][1] = pref[i - 1][0] + 1
		else:
			pref[i][0] = pref[i - 1][1] + 1
			pref[i][1] = 0
	suff = [[0, 0] for i in range(n + 1)]
	for i in range(n - 1, -1, -1):
		if s[i] == 'L':
			suff[i][0] = 0
			suff[i][1] = suff[i + 1][0] + 1
		else:
			suff[i][0] = suff[i + 1][1] + 1
			suff[i][1] = 0
	print(' '.join((str(pref[i][0] + suff[i][0] + 1) for i in range(n + 1))))


import sys
from collections import deque
from math import gcd
for _ in range(int(input())):
	n = int(input())
	s = input()
	A = [[1, 1] for _ in range(n + 1)]
	ans = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			A[i][0] = 1 + A[i - 1][1]
		else:
			A[i][1] = 1 + A[i - 1][0]
		ans[i] += A[i][0]
	A = [[1, 1] for _ in range(n + 1)]
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			A[i][0] = 1 + A[i + 1][1]
		else:
			A[i][1] = 1 + A[i + 1][0]
		ans[i] += A[i][0] - (1 if i != 0 else 0)
	print(*ans)


import io
import os
from collections import Counter, defaultdict, deque

class UnionFind:

	def __init__(self, N):
		self.p = [-1 for i in range(N)]

	def find(self, i):
		if self.p[i] >= 0:
			self.p[i] = self.find(self.p[i])
			return self.p[i]
		else:
			return i

	def union(self, i, j):
		root1 = self.find(j)
		root2 = self.find(i)
		if root1 == root2:
			return
		size1 = -self.p[root1]
		size2 = -self.p[root2]
		if size1 < size2:
			self.p[root1] = root2
			self.p[root2] = -(size1 + size2)
		else:
			self.p[root2] = root1
			self.p[root1] = -(size1 + size2)

	def getComponentSize(self, i):
		return -self.p[self.find(i)]

def solve(N, S):
	graph = [[] for i in range(2 * (N + 1))]
	for i in range(N):
		j = i + 1
		if S[i] == 'L':
			graph[j].append(N + 1 + i)
			graph[N + 1 + i].append(j)
		else:
			graph[i].append(N + 1 + j)
			graph[N + 1 + j].append(i)
	uf = UnionFind(len(graph))
	for u in range(len(graph)):
		for v in graph[u]:
			uf.union(u, v)
	return ' '.join((str(uf.getComponentSize(u)) for u in range(N + 1)))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	S = input().decode().rstrip()
	ans = solve(N, S)
	print(ans)


import collections
import sys
import functools
import heapq
import bisect
import collections
import math
input = sys.stdin.readline
mod = 10 ** 9 + 7
t = int(input())
for _ in range(t):
	n = int(input().strip())
	s = input().strip()
	right = [[0, 0] for i in range(n)]
	left = [[0, 0] for i in range(n)]
	if s[-1] == 'L':
		right[-1][1] = 1
	else:
		right[-1][0] = 1
	for i in range(n - 2, -1, -1):
		if s[i] == 'L':
			right[i][1] = 1 + right[i + 1][0]
		else:
			right[i][0] = 1 + right[i + 1][1]
	if s[0] == 'L':
		left[0][1] = 1
	else:
		left[0][0] = 1
	for i in range(1, n):
		if s[i] == 'L':
			left[i][1] = 1 + left[i - 1][0]
		else:
			left[i][0] = 1 + left[i - 1][1]
	for i in range(n + 1):
		if i == 0:
			print(1 + right[i][0], end=' ')
		elif i == n:
			print(1 + left[i - 1][1], end=' ')
		else:
			print(1 + left[i - 1][1] + right[i][0], end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	st = input()
	dp_left = [i for i in range(n + 1)]
	for i in range(n + 1):
		if i == 0 or st[i - 1] == 'R':
			dp_left[i] = i
		elif i == 1 or st[i - 2] == 'L':
			dp_left[i] = i - 1
		else:
			dp_left[i] = dp_left[i - 2]
	dp_right = [i for i in range(n + 1)]
	for i in range(n, -1, -1):
		if i == n or st[i] == 'L':
			dp_right[i] = i
		elif i == n - 1 or st[i + 1] == 'R':
			dp_right[i] = i + 1
		else:
			dp_right[i] = dp_right[i + 2]
	print(end='\n')
	for i in range(n + 1):
		print(dp_right[i] - dp_left[i] + 1, end=' ')


num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()
for t in range(int(input())):
	n = int(input())
	s = input()
	a = [1] * (n + 1)
	b = [1] * (n + 1)
	for (i, c) in enumerate(s):
		if c == 'L':
			a[i + 1] = b[i] + 1
		else:
			b[i + 1] = a[i] + 1
	for (i, c) in reversed(list(enumerate(s))):
		if c == 'L':
			b[i] = a[i + 1]
		else:
			a[i] = b[i + 1]
	print(*a)


import sys
from functools import lru_cache
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	N = int(input())
	S = input()
	L = [[1] * 2 for _ in range(N + 1)]
	R = [[1] * 2 for _ in range(N + 1)]
	for i in range(1, N + 1):
		for inv in range(2):
			ok = S[i - 1] == 'L'
			if inv:
				ok = not ok
			if ok:
				L[i][inv] += L[i - 1][1 - inv]
	for i in range(N - 1, -1, -1):
		for inv in range(2):
			ok = S[i] == 'R'
			if inv:
				ok = not ok
			if ok:
				R[i][inv] += R[i + 1][1 - inv]
	print(' '.join((str(L[i][0] + R[i][0] - 1) for i in range(N + 1))))


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	s = input()
	dp = [1] * n
	dp1 = [1] * n
	ind1 = [n - 1]
	for i in range(n - 2, -1, -1):
		if s[i] != s[i + 1]:
			dp[i] = dp[i + 1] + 1
		if dp[i] == 1:
			ind1.append(i)
	ind = [0]
	for i in range(1, n):
		if s[i] != s[i - 1]:
			dp1[i] = dp1[i - 1] + 1
		if dp1[i] == 1:
			ind.append(i)
	ind1.sort()
	ans = [1] * (n + 1)
	for i in range(n + 1):
		at = binarySearchCount(ind1, len(ind1), i - 2)
		at1 = countGreater(ind, len(ind), i + 1)
		if i != 0:
			if s[i - 1] == 'L':
				if at > 0:
					ans[i] += i - ind1[at - 1] - 1
				else:
					ans[i] += i
		if i != n:
			if s[i] == 'R':
				if at1 > 0:
					ans[i] += ind[len(ind) - at1] - i
				else:
					ans[i] += n - i
	print(*ans)


import sys
input = sys.stdin.readline

def solution(n, s):
	go_right_even = [1 for _ in range(n + 1)]
	go_right_odd = [1 for _ in range(n + 1)]
	go_left_even = [1 for _ in range(n + 1)]
	go_left_odd = [1 for _ in range(n + 1)]
	sol = []
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			go_right_even[i] = go_right_odd[i + 1] + 1
		if s[i] == 'L':
			go_right_odd[i] = go_right_even[i + 1] + 1
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			go_left_even[i] = go_left_odd[i - 1] + 1
		if s[i - 1] == 'R':
			go_left_odd[i] = go_left_even[i - 1] + 1
	sol = [go_right_even[i] + go_left_even[i] - 1 for i in range(n + 1)]
	print(*sol)
T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	solution(n, s)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	dp = [0] * (n + 1)
	dpr = [0] * (n + 1)
	for i in range(1, n + 1):
		a = i
		b = i
		if i - 1 >= 0:
			if s[i - 1] == 'L':
				a = i - 1
		if i - 2 >= 0:
			if s[i - 2] == 'R' and s[i - 1] == 'L':
				b = dp[i - 2]
		dp[i] = min(a, b)
	dpr[n] = n
	for i in reversed(range(0, n)):
		a = i
		b = i
		if i < n:
			if s[i] == 'R':
				a = i + 1
		if i + 1 < n:
			if s[i + 1] == 'L' and s[i] == 'R':
				b = dpr[i + 2]
		dpr[i] = max(a, b)
	f = [0] * (n + 1)
	for i in range(n + 1):
		f[i] = dpr[i] - dp[i] + 1
	print(*f)


import os, sys
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(input())
	toright = [0] * n
	toright[0] = 1
	for i in range(1, n):
		if l[i] != l[i - 1]:
			toright[i] += toright[i - 1] + 1
		else:
			toright[i] = 1
			continue
	toleft = [0] * n
	toleft[-1] = 1
	for i in range(n - 2, -1, -1):
		if l[i] != l[i + 1]:
			toleft[i] += toleft[i + 1] + 1
		else:
			toleft[i] = 1
			continue
	for i in range(n + 1):
		a = 0
		if i < n and l[i] == 'R':
			a += toleft[i]
		if i > 0 and l[i - 1] == 'L':
			a += toright[i - 1]
		print(a + 1, end=' ')
	print()


import sys
for tc in range(int(input())):
	n = int(sys.stdin.readline().strip())
	p = sys.stdin.readline().strip()
	L = [0]
	Lt = ''
	Lc = 0
	for i in range(n):
		if p[i] == 'R':
			if Lt == 'L':
				Lc += 1
			else:
				Lc = 1
			Lt = 'R'
			L.append(0)
		else:
			if Lt == 'R':
				Lc += 1
			else:
				Lc = 1
			Lt = 'L'
			L.append(Lc)
	R = [0]
	Rt = ''
	Rc = 0
	p = p[::-1]
	for i in range(n):
		if p[i] == 'L':
			if Rt == 'R':
				Rc += 1
			else:
				Rc = 1
			Rt = 'L'
			R.append(0)
		else:
			if Rt == 'L':
				Rc += 1
			else:
				Rc = 1
			Rt = 'R'
			R.append(Rc)
	R = R[::-1]
	ans = []
	for i in range(n + 1):
		ans.append(L[i] + R[i] + 1)
	print(' '.join(map(str, ans)))


import math
for t in range(int(input())):
	n = int(input())
	a = input()
	storel = [1 for i in range(n)]
	for i in range(1, n):
		if a[i] != a[i - 1]:
			storel[i] += storel[i - 1]
	b = a[::-1]
	storer = [1 for i in range(n)]
	for i in range(1, n):
		if b[i] != b[i - 1]:
			storer[i] += storer[i - 1]
	storer = storer[::-1]
	for i in range(n + 1):
		ans = 1
		if i != n and a[i] == 'R':
			ans += storer[i]
		if i != 0 and a[i - 1] == 'L':
			ans += storel[i - 1]
		print(ans, end=' ')
	print()


from sys import *
from math import ceil
ws = lambda : map(int, stdin.readline().strip().split())
li = lambda : list(map(int, stdin.readline().strip().split()))
mod = 1000000007

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def prod(l):
	ans = 1
	for i in range(len(l)):
		ans = ans * l[i]
	return ans

def sortindex(l, a):
	c = []
	if a == -1:
		rev = True
	else:
		rev = False
	for i in range(len(l)):
		c.append([l[i], i])
	x = sorted(c, reverse=rev)
	print(x)
	c = []
	for i in range(len(l)):
		c.append(x[i][1])
	return c
for _ in range(int(input())):
	n = int(input())
	s = stdin.readline().strip()
	l = [1] * n
	for i in range(len(s)):
		if s[i] == 'L':
			l[i] = -1
		else:
			l[i] = 1
	forw = [(0, 0)] * (n + 1)
	back = [(0, 0)] * (n + 1)
	count = 0
	for i in range(len(s) + 1):
		flag = 0
		if i == 0:
			back[i] = (0, 0)
		elif l[i - 1] == -1:
			back[i] = (1 + back[i - 1][1], 0)
		else:
			back[i] = (0, 1 + back[i - 1][0])
	for i in range(len(s) + 1):
		flag = 0
		if i == 0:
			forw[-1] = (0, 0)
		elif l[-i] == 1:
			forw[-1 - i] = (1 + forw[-i][1], 0)
		else:
			forw[-1 - i] = (0, 1 + forw[-i][0])
	ans = []
	for i in range(n + 1):
		ans.append(back[i][0] + forw[i][0] + 1)
	print(*ans)


from sys import stdin, stdout
readline = stdin.readline
write = stdout.write

def read_ints():
	return map(int, readline().split())

def read_string():
	return readline()[:-1]

def update_result(s, result):
	cities_n = len(s) + 1
	next_break = [None] * cities_n
	last_break = cities_n - 1
	for i in reversed(range(cities_n)):
		if i == cities_n - 1:
			next_break[i] = last_break
			continue
		next_break[i] = last_break
		if i != 0 and s[i - 1] == s[i]:
			last_break = i
	for i in range(cities_n - 1):
		if s[i] != 'R':
			continue
		result[i] += next_break[i] - i
(t_n,) = read_ints()
for i_t in range(t_n):
	(n,) = read_ints()
	s = read_string()
	assert len(s) == n
	result = [1] * (n + 1)
	update_result(s, result)
	inv_s = ''.join(['R' if ch == 'L' else 'L' for ch in s])[::-1]
	result.reverse()
	update_result(inv_s, result)
	result.reverse()
	write(' '.join(map(str, result)))
	write('\n')


import sys
input = sys.stdin.readline

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.root = [-1] * (n + 1)
		self.rnk = [0] * (n + 1)

	def Find_Root(self, x):
		if self.root[x] < 0:
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return -self.root[self.Find_Root(x)]
for _ in range(int(input())):
	N = int(input())
	S = list(input())[:-1]
	uf = UnionFind(2 * (N + 1))
	for i in range(N):
		if S[i] == 'L':
			uf.Unite(i + 1, N + 1 + i)
		else:
			uf.Unite(i, N + 1 + i + 1)
	print(*[uf.Count(i) for i in range(N + 1)])


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		N = int(input())
		S = input().rstrip('\n')
		cs_L = [0] * (N + 1)
		for (i, s) in enumerate(S):
			if i != 0:
				if S[i - 1] != s:
					cs_L[i + 1] = cs_L[i] + 1
				else:
					cs_L[i + 1] = 1
			else:
				cs_L[i + 1] = 1
		cs_R = [0] * (N + 1)
		for i in range(N - 1, -1, -1):
			s = S[i]
			if i != N - 1:
				if S[i + 1] != s:
					cs_R[i] = cs_R[i + 1] + 1
				else:
					cs_R[i] = 1
			else:
				cs_R[i] = 1
		ans = []
		for i in range(N + 1):
			x = 1
			if i != 0:
				if S[i - 1] == 'L':
					x += cs_L[i]
			if i != N:
				if S[i] == 'R':
					x += cs_R[i]
			ans.append(x)
		print(*ans)
main()


def solve(n, s):
	p = []
	dpl = [0]
	dpr = [0]
	for i in range(1, n + 1):
		if s[i - 1] == 'R':
			dpl.append(0)
		elif dpl[i - 1] or i == 1:
			dpl.append(1)
		else:
			dpl.append(2 + dpl[i - 2])
	for i in range(n - 1, -1, -1):
		if s[i] == 'L':
			dpr.append(0)
		elif dpr[-1] or i == n - 1:
			dpr.append(1)
		else:
			dpr.append(2 + dpr[-2])
	for i in range(n + 1):
		p.append(1 + dpl[i] + dpr[n - i])
	return p

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input()
		print(*solve(n, s))
main()


t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	l1 = [0] * (n + 1)
	l2 = [0] * (n + 1)
	s = input()
	if s[0] == 'L':
		l1[1] += 1
	for j in range(1, n):
		if s[j] == 'L':
			if l1[j] == 0:
				l1[j + 1] = 2 + l1[j - 1]
			else:
				l1[j + 1] = 1
	if s[n - 1] == 'R':
		l2[n - 1] += 1
	for k in range(n - 2, -1, -1):
		if s[k] == 'R':
			if l2[k + 1] == 0:
				l2[k] = 2 + l2[k + 2]
			else:
				l2[k] = 1
	for m in range(n + 1):
		print(l1[m] + l2[m] + 1, end=' ')
	print()


for t in range(int(input())):
	n = int(input())
	s = input()
	a = [1] * (n + 1)
	b = [1] * (n + 1)
	for (i, c) in enumerate(s):
		if c == 'L':
			a[i + 1] = b[i] + 1
		else:
			b[i + 1] = a[i] + 1
	for (i, c) in reversed(list(enumerate(s))):
		if c == 'L':
			b[i] = a[i + 1]
		else:
			a[i] = b[i + 1]
	print(*a)


import sys
import os.path
from collections import *
import math
import bisect
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input().rstrip('\n')
	arr = [1] * n
	arr1 = []
	h1 = [0] * (n + 1)
	h2 = [0] * (n + 1)
	arr = [1] * (n + 1)
	for i in range(n - 2, -1, -1):
		if s[i] != s[i + 1]:
			h1[i] = 1 + h1[i + 1]
	for i in range(2, n + 1):
		if s[i - 1] != s[i - 2]:
			h2[i] = 1 + h2[i - 1]
	for i in range(n):
		if s[i] == 'R':
			arr[i] += 1 + h1[i]
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			arr[i] += 1 + h2[i]
	for i in range(n + 1):
		print(arr[i], end=' ')
	print()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import sys
input = sys.stdin.readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	s = st()
	l1odd = [0]
	l1even = [0]
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			l1even.append(l1odd[-1] + 1)
			l1odd.append(0)
		else:
			l1odd.append(l1even[-1] + 1)
			l1even.append(0)
	l2odd = [0]
	l2even = [0]
	for i in range(n, 0, -1):
		if s[i - 1] == 'R':
			l2even.append(1 + l2odd[-1])
			l2odd.append(0)
		else:
			l2odd.append(l2even[-1] + 1)
			l2even.append(0)
	l2odd.reverse()
	l2even.reverse()
	ans = []
	for i in range(n + 1):
		ans.append(l1even[i] + l2even[i] + 1)
	print(*ans)


from math import ceil
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	l = [0]
	for j in range(n):
		if j > 0:
			if s[j] == 'L' and s[j - 1] == 'R':
				l.append(l[-2] + 2)
			elif s[j] == 'L':
				l.append(1)
			else:
				l.append(0)
		elif s[j] == 'L':
			l.append(1)
		else:
			l.append(0)
	r = [0]
	for j in range(n - 1, -1, -1):
		if j < n - 1:
			if s[j] == 'R' and s[j + 1] == 'L':
				r.append(r[-2] + 2)
			elif s[j] == 'R':
				r.append(1)
			else:
				r.append(0)
		elif s[j] == 'R':
			r.append(1)
		else:
			r.append(0)
	r.reverse()
	for i in range(n + 1):
		print(l[i] + r[i] + 1, end=' ')
	print()


import sys
t = int(input())
for o in range(0, t, 1):
	n = int(input())
	s = input()
	l = [[-1, -1] for _ in range(n + 1)]
	r = [[-1, -1] for _ in range(n + 1)]
	l[0][0] = 0
	l[0][1] = 0
	r[n][0] = n
	r[n][1] = n
	for a in range(1, n + 1):
		if s[a - 1] == 'R':
			l[a][1] = l[a - 1][0]
			l[a][0] = a
		else:
			l[a][0] = l[a - 1][1]
			l[a][1] = a
	for a in range(n - 1, -1, -1):
		if s[a] == 'R':
			r[a][0] = r[a + 1][1]
			r[a][1] = a
		else:
			r[a][0] = a
			r[a][1] = r[a + 1][0]
	for q in range(0, n + 1, 1):
		print(r[q][0] - l[q][0] + 1, end=' ')
	print()


import sys
input = sys.stdin.readline

def solution():
	n = int(input())
	LR = input().rstrip()
	left = [0] * (n + 1)
	right = [0] * (n + 1)
	S = 0
	before = '-'
	for i in range(n):
		if LR[i] == 'L':
			if before == 'R':
				S += 1
			else:
				S = 1
			left[i + 1] = S
		elif LR[i] == 'R':
			if before == 'L':
				S += 1
			else:
				S = 1
		before = LR[i]
	S = 0
	before = '-'
	for i in range(n - 1, -1, -1):
		if LR[i] == 'R':
			if before == 'L':
				S += 1
			else:
				S = 1
			right[i] = S
		elif LR[i] == 'L':
			if before == 'R':
				S += 1
			else:
				S = 1
		before = LR[i]
	for i in range(n + 1):
		print(1 + left[i] + right[i], end=' ')
	print()
T = int(input())
for _ in range(T):
	solution()


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
from queue import PriorityQueue as pq
for _ in range(int(input())):
	n = int(input())
	s = input()[:-1]
	r = [0] * n
	l = [0] * n
	for i in range(n - 2, -1, -1):
		if s[i] != s[i + 1]:
			r[i] = 1 + r[i + 1]
	for i in range(1, n):
		if s[i] != s[i - 1]:
			l[i] = 1 + l[i - 1]
	t = [1] * (n + 1)
	for i in range(n + 1):
		if i == 0:
			if s[i] == 'R':
				t[i] += 1 + r[i]
		elif i == n:
			if s[i - 1] == 'L':
				t[i] += 1 + l[i - 1]
		else:
			if s[i] == 'R':
				t[i] += 1 + r[i]
			if s[i - 1] == 'L':
				t[i] += 1 + l[i - 1]
	print(*t)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from fractions import Fraction
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
from math import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gcl()
	(l, r) = ([0] * (n + 1), [0] * (n + 1))
	l[1] = 1
	for i in range(2, n + 1):
		l[i] = 1
		if a[i - 1] != a[i - 2]:
			l[i] += l[i - 1]
	r[-2] = 1
	for i in reversed(range(n - 1)):
		r[i] = 1
		if a[i] != a[i + 1]:
			r[i] += r[i + 1]
	for i in range(n):
		if a[i] == 'R' and i + 1 < n + 1:
			l[i + 1] = 0
		elif a[i] == 'L':
			r[i] = 0
	ans = [1 + l[i] + r[i] for i in range(n + 1)]
	print(*ans, sep=' ')


T = int(input())
for t in range(T):
	n = int(input())
	s = input()
	fwd = {0: {0: 1}, 1: {0: 1}}
	bwd = {0: {n: 1}, 1: {n: 1}}
	for i in range(n):
		if s[i] == 'L':
			fwd[1][i + 1] = 1 + fwd[0][i]
			fwd[0][i + 1] = 1
		else:
			fwd[1][i + 1] = 1
			fwd[0][i + 1] = 1 + fwd[1][i]
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			bwd[1][i] = 1 + bwd[0][i + 1]
			bwd[0][i] = 1
		else:
			bwd[1][i] = 1
			bwd[0][i] = 1 + bwd[1][i + 1]
	num_cities = []
	for i in range(n + 1):
		num_city = 1
		if i - 1 >= 0 and s[i - 1] == 'L':
			num_city += fwd[0][i - 1]
		if i + 1 <= n and s[i] == 'R':
			num_city += bwd[0][i + 1]
		num_cities.append(num_city)
	print(' '.join([str(x) for x in num_cities]))


from sys import stdin, stdout
import math
from functools import reduce

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		arr = stdin.readline().strip()
		dp_l = [0 for _ in range(n)]
		prev = 'R'
		cnt = 0
		for (i, x) in enumerate(arr):
			if prev == 'R' and x == 'L':
				cnt += 1
			elif prev == 'L' and x == 'R':
				cnt += 1
			else:
				cnt = 1
			prev = x
			dp_l[i] = cnt
		dp_r = [0 for _ in range(n)]
		prev = 'L'
		cnt = 0
		for i in range(n - 1, -1, -1):
			x = arr[i]
			if prev == 'R' and x == 'L':
				cnt += 1
			elif prev == 'L' and x == 'R':
				cnt += 1
			else:
				cnt = 1
			prev = x
			dp_r[i] = cnt
		ans = []
		for i in range(n + 1):
			sm = 1
			if i > 0:
				if arr[i - 1] == 'L':
					sm += dp_l[i - 1]
			if i < n:
				if arr[i] == 'R':
					sm += dp_r[i]
			ans.append(str(sm))
		stdout.write(' '.join(ans) + '\n')
main()


from sys import stdin, exit
from bisect import bisect_left as bl, bisect_right as br
from itertools import accumulate
input = lambda : stdin.readline()[:-1]
intput = lambda : int(input())
sinput = lambda : input().split()
intsput = lambda : map(int, sinput())

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)
debugging = 1
t = intput()
for _ in range(t):
	n = intput()
	s = input()
	switches = [0]
	for i in range(1, len(s)):
		prev = s[i - 1]
		curr = s[i]
		if prev == curr:
			switches.append(i)
	switches.append(n)
	ans = []
	for i in range(n + 1):
		cnt = 1
		if i < n:
			if s[i] == 'R':
				cut = switches[br(switches, i)]
				cnt += cut - i
		if i > 0:
			if s[i - 1] == 'L':
				cut = switches[bl(switches, i) - 1]
				cnt += i - cut
		ans.append(cnt)
	print(' '.join(map(str, ans)))


t = int(input())
for i in range(t):
	n = int(input())
	r = list(input())
	lst1 = [0] * (n + 1)
	lst2 = [0] * (n + 1)
	lst1[-1] = 0
	i = n
	while i > 0:
		if i == n:
			if r[n - 1] == 'R':
				lst1[i - 1] = 1
		elif r[i - 1] == 'R':
			if r[i - 1] != r[i]:
				lst1[i - 1] = 2 + lst1[i + 1]
			else:
				lst1[i - 1] = 1
		else:
			lst1[i - 1] = 0
		i -= 1
	for i in range(1, n + 1):
		if i == 1:
			if r[i - 1] == 'L':
				lst2[i] = 1
		elif r[i - 1] == 'L':
			if r[i - 1] != r[i - 2]:
				lst2[i] = 2 + lst2[i - 2]
			else:
				lst2[i] = 1
		else:
			lst2[i] = 0
	lst3 = [lst1[i] + lst2[i] + 1 for i in range(n + 1)]
	for i in range(len(lst3)):
		print(lst3[i], end=' ')
	print()


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
from itertools import permutations, combinations

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
from fractions import Fraction
sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
for t in range(int(data())):
	n = int(data())
	s = data()
	forw = [1] * (n + 1)
	back = [1] * (n + 1)
	for i in range(1, n):
		if s[i - 1] != s[i]:
			forw[i + 1] = forw[i] + 1
		else:
			forw[i + 1] = 1
		if s[n - i] != s[n - 1 - i]:
			back[n - i - 1] = back[n - i] + 1
		else:
			back[n - i - 1] = 1
	ans = [1] * (n + 1)
	for i in range(n):
		if s[i] == 'R':
			ans[i] += back[i]
		else:
			ans[i + 1] += forw[i + 1]
	outl(ans)


import sys
for _ in range(int(input())):
	n = int(input())
	s = input()
	A = [[1, 1] for _ in range(n + 1)]
	ans = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			A[i][0] = 1 + A[i - 1][1]
		else:
			A[i][1] = 1 + A[i - 1][0]
		ans[i] += A[i][0]
	A = [[1, 1] for _ in range(n + 1)]
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			A[i][0] = 1 + A[i + 1][1]
		else:
			A[i][1] = 1 + A[i + 1][0]
		ans[i] += A[i][0] - 1
	ans[0] += 1
	print(*ans)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	inx = 0
	num = 0
	right = []
	while inx < n:
		if s[inx] == 'L':
			right.append(0)
			num = 0
			inx += 1
			continue
		s_inx = inx
		pref = s[inx]
		inx += 1
		num += 1
		while inx < n:
			if s[inx] != pref:
				pref = s[inx]
				inx += 1
				num += 1
			else:
				break
		for i in range(inx - s_inx):
			if i % 2 == 0:
				right.append(num)
				num -= 2
			else:
				right.append(0)
		num = 0
		if inx < n:
			pref = s[inx]
	inx = 0
	num = 0
	left = []
	sr = s[::-1]
	while inx < n:
		if sr[inx] == 'R':
			left.append(0)
			num = 0
			inx += 1
			continue
		s_inx = inx
		pref = sr[inx]
		inx += 1
		num += 1
		while inx < n:
			if sr[inx] != pref:
				pref = sr[inx]
				inx += 1
				num += 1
			else:
				break
		for i in range(inx - s_inx):
			if i % 2 == 0:
				left.append(num)
				num -= 2
			else:
				left.append(0)
		num = 0
		if inx < n:
			pref = sr[inx]
	right.append(0)
	left.append(0)
	left = left[::-1]
	ans = []
	for (i, j) in zip(left, right):
		ans.append(i + j + 1)
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	s = input()
	right = [0] * (n + 1)
	left = [0] * (n + 1)
	for i in range(n, -1, -1):
		if i + 1 > n or s[i] == 'L':
			right[i] = i
		elif i + 2 > n or s[i + 1] == 'R':
			right[i] = i + 1
		else:
			right[i] = right[i + 2]
	for i in range(n + 1):
		if i - 1 < 0 or s[i - 1] == 'R':
			left[i] = i
		elif i - 2 < 0 or s[i - 2] == 'L':
			left[i] = i - 1
		else:
			left[i] = left[i - 2]
	ans = [0] * (n + 1)
	for i in range(n + 1):
		ans[i] = right[i] - left[i] + 1
	print(*ans)


from __future__ import division, print_function
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt, log2
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def testcase(t):
	for pp in range(t):
		solve(pp)

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def solve(case):
	n = int(inp())
	a = ['0'] + list(inp())
	right = [0] * (n + 3)
	for i in range(n - 1, -1, -1):
		if (n - i) % 2 == 0:
			if a[i + 1] + a[i + 2] == 'RL':
				right[i] = right[i + 2] + 2
			else:
				right[i] = 1 if a[i + 1] == 'R' else 0
		elif i + 2 <= n and a[i + 1] + a[i + 2] == 'RL':
			right[i] = right[i + 2] + 2
		else:
			right[i] = 1 if a[i + 1] == 'R' else 0
	left = [0] * (n + 3)
	for i in range(1, n + 1):
		if a[i - 1] + a[i] == 'RL':
			left[i] = left[i - 2] + 2
		else:
			left[i] = 1 if a[i] == 'L' else 0
	ans = [right[i] + left[i] for i in range(n + 1)]
	print(' '.join((str(i + 1) for i in ans)))
testcase(int(inp()))


import sys
input = sys.stdin.readline

class UnionFind:

	def __init__(self, n):
		self.parent = [-1] * n
		self.n = n
		self.cnt = n

	def root(self, x):
		if self.parent[x] < 0:
			return x
		else:
			self.parent[x] = self.root(self.parent[x])
			return self.parent[x]

	def merge(self, x, y):
		x = self.root(x)
		y = self.root(y)
		if x == y:
			return False
		if self.parent[x] > self.parent[y]:
			(x, y) = (y, x)
		self.parent[x] += self.parent[y]
		self.parent[y] = x
		self.cnt -= 1
		return True

	def same(self, x, y):
		return self.root(x) == self.root(y)

	def size(self, x):
		return -self.parent[self.root(x)]

	def count(self):
		return self.cnt

	def groups(self):
		res = [[] for _ in range(self.n)]
		for i in range(self.n):
			res[self.root(i)].append(i)
		return [group for group in res if group]
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()[:-1]
	uf0 = UnionFind(n + 1)
	uf1 = UnionFind(n + 1)
	for (i, char) in enumerate(s):
		if i % 2 == 0:
			if char == 'L':
				uf1.merge(i, i + 1)
			else:
				uf0.merge(i, i + 1)
		elif char == 'L':
			uf0.merge(i, i + 1)
		else:
			uf1.merge(i, i + 1)
	ans = [0] * (n + 1)
	for i in range(n + 1):
		if i % 2 == 0:
			ans[i] = uf0.size(i)
		else:
			ans[i] = uf1.size(i)
	print(*ans)


import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
	N = int(input())
	S = input()
	C = [[0] * (N + 1) for i in range(4)]
	for i in range(N):
		for j in range(2):
			if (S[i] == 76) ^ bool((i ^ j) & 1):
				C[j * 2][i + 1] = C[j * 2][i] + 1
			else:
				C[j * 2][i + 1] = 0
	for i in range(N - 1, -1, -1):
		for j in range(2):
			if (S[i] == 82) ^ bool((i ^ j) & 1):
				C[1 + j * 2][i] = C[1 + j * 2][i + 1] + 1
			else:
				C[1 + j * 2][i] = 0
	print(*[C[2 - (i & 1) * 2][i] + C[(i & 1) * 2 + 1][i] + 1 for i in range(N + 1)])


def root(i):
	while i != arr[i]:
		i = arr[i]
		arr[i] = arr[arr[i]]
	return i

def update(a, b):
	ra = root(a)
	rb = root(b)
	if ra != rb:
		if size[ra] > size[rb]:
			arr[rb] = ra
			size[ra] += size[rb]
		else:
			arr[ra] = rb
			size[rb] += size[ra]
for _ in range(int(input())):
	n = int(input())
	s = input()
	arr = [i for i in range(2 * n + 5)]
	size = [1] * (2 * n + 5)
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			update(i, i + n)
		else:
			update(i + n + 1, i - 1)
	res = [0] * (n + 1)
	for i in range(n + 1):
		res[i] = size[root(i)]
	print(*res)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	dp_left = [0 for i in range(n + 1)]
	dp_right = [0 for i in range(n + 1)]
	for j in range(2):
		for i in range(j + 1, n + 1):
			if (i + j) % 2 == 1 and s[i - 1] == 'R':
				dp_right[j] += 1
			elif (i + j) % 2 == 0 and s[i - 1] == 'L':
				dp_right[j] += 1
			else:
				break
	if s[0] == 'L':
		dp_left[1] = 1
	for i in range(2, n + 1):
		if s[i - 1] == 'L' and s[i - 2] == 'R':
			dp_left[i] = dp_left[i - 2] + 2
		elif s[i - 1] == 'L' and s[i - 2] == 'L':
			dp_left[i] = 1
		if dp_right[i - 2] >= 2:
			dp_right[i] = dp_right[i - 2] - 2
		else:
			for j in range(i + 1, n + 1):
				if (i + j) % 2 == 1 and s[j - 1] == 'R':
					dp_right[i] += 1
				elif (i + j) % 2 == 0 and s[j - 1] == 'L':
					dp_right[i] += 1
				else:
					break
	print(1 + dp_right[0], end=' ')
	for i in range(1, n + 1):
		print(1 + dp_left[i] + dp_right[i], end=' ')
	print('')


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = input()
	to_left = [0]
	for i in range(n):
		if i == 0:
			if a[i] == 'L':
				to_left.append(1)
			else:
				to_left.append(0)
		elif a[i] == 'R':
			to_left.append(0)
		elif a[i - 1] == 'R':
			to_left.append(to_left[-2] + 2)
		else:
			to_left.append(1)
	to_right = [0]
	for i in range(n - 1, -1, -1):
		if i == n - 1:
			if a[i] == 'R':
				to_right.append(1)
			else:
				to_right.append(0)
		elif a[i] == 'L':
			to_right.append(0)
		elif a[i + 1] == 'L':
			to_right.append(to_right[-2] + 2)
		else:
			to_right.append(1)
	to_right = to_right[::-1]
	for (x, y) in zip(to_right, to_left):
		print(x + y + 1, end=' ')
	print()


def left(n, string):
	l0 = [0] * (n + 1)
	l1 = [0] * (n + 1)
	for i in range(1, n + 1):
		l0[i] = l1[i - 1] + 1 if string[i - 1] == 'L' else 0
		l1[i] = l0[i - 1] + 1 if string[i - 1] == 'R' else 0
	return l0

def right(n, string):
	r0 = [0] * (n + 1)
	r1 = [0] * (n + 1)
	for i in range(n - 1, -1, -1):
		r0[i] = r1[i + 1] + 1 if string[i] == 'R' else 0
		r1[i] = r0[i + 1] + 1 if string[i] == 'L' else 0
	return r0
for i in range(int(input())):
	n = int(input())
	string = input()
	(r, l) = (right(n, string), left(n, string))
	print(' '.join(map(str, [1 + r[i] + l[i] for i in range(n + 1)])))


from math import ceil
t = int(input())
for z in range(t):
	n = int(input())
	rin = [-1 if s == 'L' else 1 for s in input()]
	ldp = []
	rdp = []
	l = r = 0
	lv = rv = 0
	for i in range(n + 1):
		if i == 0:
			ldp.append(0)
			l = 1
			lv = rin[0]
			rdp.append(0)
			r = 1
			rv = rin[n - 1]
			continue
		ldp.append(l)
		rdp.append(r)
		if i == n:
			break
		if rin[i] == lv:
			l = 1
		else:
			l += 1
		lv = rin[i]
		if rin[n - i - 1] == rv:
			r = 1
		else:
			r += 1
		rv = rin[n - i - 1]
	dp = [1 for x in range(n + 1)]
	rdp.reverse()
	for i in range(n + 1):
		if i != 0 and rin[i - 1] == -1:
			dp[i] += ldp[i]
			pass
		if i != n and rin[i] == 1:
			dp[i] += rdp[i]
			pass
		print(dp[i], end=' ')
	print()


for w in range(int(input())):
	n = int(input())
	a = str(input())
	i = 0
	t = 0
	j = 0
	ans = [0] * (n + 1)
	left = [0] * (n + 1)
	right = [0] * (n + 1)
	while i < n + 1:
		if i == 0:
			left[i] = 1
		elif i == 1:
			if a[i - 1] == 'L':
				left[i] = 2
			else:
				left[i] = 1
		elif a[i - 1] == 'L' and a[i - 2] == 'R':
			left[i] = left[i - 2] + 2
		elif a[i - 1] == 'L':
			left[i] = 2
		else:
			left[i] = 1
		i += 1
	i = n
	right[i] = 0
	i -= 1
	while i >= 0:
		if i == n - 1:
			if a[i] == 'R':
				right[i] = 1
			else:
				right[i] = 0
		elif a[i] == 'R' and a[i + 1] == 'L':
			right[i] = right[i + 2] + 2
		elif a[i] == 'R':
			right[i] = 1
		i -= 1
	for i in range(n + 1):
		print(left[i] + right[i], end=' ')
	print()


gans = []
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	for i in range(n):
		if i % 2 == 0 and s[i] == 'L':
			s[i] = -1
		elif i % 2 == 1 and s[i] == 'R':
			s[i] = -1
		else:
			s[i] = 1
	ans = [1] * (n + 1)
	curA = 0
	curB = 0
	for i in range(1, n + 1):
		if s[i - 1] == 1:
			curA += 1
			curB = 0
		else:
			curB += 1
			curA = 0
		if i % 2 == 0:
			ans[i] += curA
		else:
			ans[i] += curB
	curA = 0
	curB = 0
	for i in range(n - 1, -1, -1):
		if s[i] == 1:
			curA += 1
			curB = 0
		else:
			curB += 1
			curA = 0
		if i % 2 == 0:
			ans[i] += curA
		else:
			ans[i] += curB
	gans.append(' '.join(map(str, ans)))
print('\n'.join(gans))


from sys import stdout, stdin
t = int(input())
for _ in range(t):
	n = int(input())
	s = stdin.readline()
	pref = [[0, 0] for i in range(n + 1)]
	for i in range(1, n + 1):
		if s[i - 1] == 'R':
			pref[i][0] = 0
			pref[i][1] = pref[i - 1][0] + 1
		else:
			pref[i][0] = pref[i - 1][1] + 1
			pref[i][1] = 0
	suff = [[0, 0] for i in range(n + 1)]
	for i in range(n - 1, -1, -1):
		if s[i] == 'L':
			suff[i][0] = 0
			suff[i][1] = suff[i + 1][0] + 1
		else:
			suff[i][0] = suff[i + 1][1] + 1
			suff[i][1] = 0
	for i in range(n + 1):
		stdout.write(str(pref[i][0] + suff[i][0] + 1) + ' ')
	print()


for i in range(int(input())):
	n = int(input())
	s = input()
	t1 = [0]
	if s[0] == 'L':
		t1.append(1)
	else:
		t1.append(0)
	cnt = 1
	for i in range(1, n):
		if s[i] != s[i - 1]:
			cnt += 1
		else:
			cnt = 1
		if s[i] == 'L':
			t1.append(cnt)
		else:
			t1.append(0)
	t2 = [0]
	if s[-1] == 'R':
		t2.append(1)
	else:
		t2.append(0)
	cnt = 1
	for i in range(n - 2, -1, -1):
		if s[i] != s[i + 1]:
			cnt += 1
		else:
			cnt = 1
		if s[i] == 'R':
			t2.append(cnt)
		else:
			t2.append(0)
	for i in range(n + 1):
		print(t1[i] + t2[n - i] + 1, end=' ')
	print()


import sys
MOD = 10 ** 9 + 7
INF = float('inf')
T = int(input())
Ns = []
Ss = []
for _ in range(T):
	N = int(input())
	S = input()
	Ns.append(N)
	Ss.append(S)
for i in range(T):
	N = Ns[i]
	S = Ss[i]
	d = 1
	pre = 0
	pred = 1
	c = 0
	res = [1] * (N + 1)
	for j in range(N):
		if S[j] == 'L':
			dt = 0
		else:
			dt = 1
		if d == dt:
			for k in range(pre, j + 1):
				if (k - pre) % 2 == pred:
					res[k] += c
			c = 1
			pre = j
			pred = (d + 1) % 2
			d = dt
		else:
			c += 1
			d = dt
	for k in range(pre, N + 1):
		if (k - pre) % 2 == pred:
			res[k] += c
	print(*res)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
for _ in range(int(input())):
	n = int(input())
	s = input()
	ans = [1] * (n + 1)
	prev = 'R'
	c = 0
	for i in range(n):
		if s[i] != prev:
			c += 1
			prev = s[i]
		else:
			c = 1
		if s[i] == 'L':
			ans[i + 1] += c
	prev = 'L'
	c = 0
	for i in range(n - 1, -1, -1):
		if s[i] != prev:
			c += 1
			prev = s[i]
		else:
			c = 1
		if s[i] == 'R':
			ans[i] += c
	print(*ans)
endtime = time.time()


import sys
input = sys.stdin.readline
from sys import stdin, stdout
from collections import defaultdict, Counter
M = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input().strip()
		ans = [0] * (n + 1)
		prev = s[0]
		st = 0
		las = [-1] * n
		for i in range(1, n):
			if s[i] != prev:
				prev = s[i]
			else:
				las[i - 1] = st
				st = i
		las[n - 1] = st
		i = n - 1
		while i >= 0:
			w = i - las[i] + 1
			j = las[i]
			while i >= j:
				las[i] = w
				i -= 1
		ans[0] = las[0] + 1 if s[0] == 'R' else 1
		for i in range(n - 1):
			if s[i] == 'R' and s[i + 1] == 'L':
				ans[i + 1] = 1
			elif s[i] == 'L':
				ans[i + 1] = las[i] + 1
			else:
				ans[i + 1] = las[i + 1] + 1
		ans[n] = las[n - 1] + 1 if s[-1] == 'L' else 1
		print(*ans)
main()


t = int(input())
for _ in range(t):

	def main():
		n = int(input())
		s = list(input())
		ans = [0] * (n + 1)
		cur = 1
		start = 0
		for i in range(n):
			if i % 2 and s[i] == 'L' or (not i % 2 and s[i] == 'R'):
				cur += 1
			else:
				if i % 2:
					end = i - 1
					ns = i + 1
				else:
					end = i
					ns = i + 2
				for j in range(start + 2, end + 2, 2):
					ans[j] = cur
				ans[start] = max(ans[start], cur)
				start = ns
				cur = 1
		if (n - 1) % 2:
			end = n
		else:
			end = n - 1
		for j in range(start + 2, end + 2, 2):
			ans[j] = cur
		if start <= n:
			ans[start] = max(ans[start], cur)
		cur = 1
		start = 1
		for i in range(n):
			if i % 2 and s[i] == 'R' or (not i % 2 and s[i] == 'L'):
				cur += 1
			else:
				if i % 2:
					end = i
					ns = i + 2
				else:
					end = i - 1
					ns = i + 1
				for j in range(start + 2, end + 2, 2):
					ans[j] = cur
				ans[start] = max(ans[start], cur)
				start = ns
				cur = 1
		if (n - 1) % 2:
			end = n - 1
		else:
			end = n
		for j in range(start + 2, end + 2, 2):
			ans[j] = cur
		if start <= n:
			ans[start] = max(ans[start], cur)
		return print(' '.join(map(str, ans)))
	main()


l_dp0 = [0 for x in range(300001)]
l_dp1 = [0 for x in range(300001)]
r_dp0 = [0 for x in range(300001)]
r_dp1 = [0 for x in range(300001)]

def reset(n):
	for i in range(n + 1):
		l_dp0[i] = 0
		l_dp1[i] = 0
		r_dp0[i] = 0
		r_dp1[i] = 0

def solve():
	n = int(input())
	arr = input().rstrip()
	reset(n)
	l_dp0[0] = 1
	l_dp1[0] = 1
	for i in range(1, n + 1):
		l_dp0[i] = l_dp1[i - 1] + 1 if arr[i - 1] == 'L' else 1
		l_dp1[i] = 1 if arr[i - 1] == 'L' else l_dp0[i - 1] + 1
	r_dp0[n] = 1
	r_dp1[n] = 1
	for i in reversed(range(n)):
		r_dp0[i] = r_dp1[i + 1] + 1 if arr[i] == 'R' else 1
		r_dp1[i] = 1 if arr[i] == 'R' else r_dp0[i + 1] + 1
	ans = [str(l_dp0[i] + r_dp0[i] - 1) for i in range(n + 1)]
	print(' '.join(ans))

def main():
	T = int(input())
	for c in range(T):
		solve()
main()


from collections import deque, defaultdict
from math import sqrt, ceil, factorial, floor, inf, gcd
import bisect
import sys
import copy

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	seq = input()
	ans_L = [0]
	if seq[0] == 'L':
		ans_L.append(1)
	else:
		ans_L.append(0)
	for i in range(2, n + 1):
		if seq[i - 1] == 'L' and seq[i - 2] == 'R':
			ans_L.append(2 + ans_L[i - 2])
		elif seq[i - 1] == 'L':
			ans_L.append(1)
		else:
			ans_L.append(0)
	ans_R = [0] * (n + 1)
	if seq[-1] == 'R':
		ans_R[n - 1] = 1
	for i in range(n - 2, -1, -1):
		if seq[i] == 'R' and seq[i + 1] == 'L':
			ans_R[i] = 2 + ans_R[i + 2]
		elif seq[i] == 'R':
			ans_R[i] = 1
	for i in range(n + 1):
		print(ans_L[i] + ans_R[i] + 1, end=' ')
	print()


from sys import stdin
from collections import deque
input = stdin.readline

def bfs():
	ans = [0] * (n + 1)
	marked = set()
	r = [-1] * (n + 1)
	for i in range(n + 1):
		if r[i] != -1:
			ans[i] = ans[r[i]]
			continue
		queue = deque()
		queue.append((i, 0))
		size = 0
		while queue:
			v = queue.popleft()
			marked.add(v)
			size += 1
			if v[1] == 0:
				r[v[0]] = i
			for c in g[v[0]][v[1]]:
				if not c in marked:
					queue.append(c)
		ans[i] = size
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	s = input().rstrip()
	g = [[[] for _ in range(2)] for _ in range(n + 1)]
	for i in range(n):
		a = int(s[i] == 'R')
		g[i][1 - a].append((i + 1, a))
		g[i + 1][a].append((i, 1 - a))
	ans = bfs()
	print(*ans)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	S = listStr()
	left = []
	right = []
	curr = 0
	for i in range(N):
		if i == 0:
			curr += 1
		elif S[i] != S[i - 1]:
			curr += 1
		else:
			curr = 1
		right.append(curr)
	curr = 0
	for i in range(N - 1, -1, -1):
		if i == N - 1:
			curr += 1
		elif S[i] != S[i + 1]:
			curr += 1
		else:
			curr = 1
		left.append(curr)
	left.reverse()
	ans = []
	for i in range(N + 1):
		tmp = 1
		if i < N:
			if S[i] == 'R':
				tmp += left[i]
		if i > 0:
			if S[i - 1] == 'L':
				tmp += right[i - 1]
		ans.append(tmp)
	return ' '.join(map(str, ans))
for _ in range(getInt()):
	print(solve())


import sys
input = sys.stdin.readline
import math
import copy
import collections
from collections import deque
import heapq
import itertools
from collections import defaultdict
from collections import Counter
for _ in range(int(input())):
	n = int(input())
	s = input().rstrip()
	ans = [0] * (n + 1)
	for i in range(n + 1):
		r = 0
		l = 0
		if ans[i] == 0:
			right = False
			while i - l - 1 >= 0 and right == (s[i - l - 1] == 'R'):
				l += 1
				right = not right
			right = True
			while i + r < n and right == (s[i + r] == 'R'):
				r += 1
				right = not right
			val = l + r + 1
			for j in range(i, i + r + 1, 2):
				ans[j] = val
	for num in ans:
		print(num, end=' ')
	print()


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

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

def readString():
	return input().rstrip()

def readCase():
	return readString()

def find_end(p, directions):
	target = 'R'
	while p < len(directions):
		if directions[p] == target:
			p += 1
			if target == 'R':
				target = 'L'
			else:
				target = 'R'
		else:
			return p
	return p

def solve(n, directions):
	results = [0 for _ in range(n)]
	p = 0
	while p < n:
		reachable = 1
		if p != 0 and directions[p - 1] == 'L':
			reachable += 1
		new_p = find_end(p, directions)
		reachable += new_p - p
		for t in range(p, new_p + 1):
			if (t - p) % 2 == 0:
				results[t] = reachable
			else:
				results[t] = 1
		if new_p < n - 1 and directions[new_p] == 'R':
			p = new_p
		else:
			p = new_p + 1
	return ' '.join((str(x) for x in results))
cases = readInt()
for case in range(cases):
	n = readInt()
	directions = list(readString())
	print(solve(n + 1, directions))


def journey(n, s):
	dp_odd = [0]
	dp_even = [0]
	for i in range(n):
		if s[i] == 'L':
			dp_odd.append(1 + dp_even[i])
			dp_even.append(0)
		else:
			dp_even.append(1 + dp_odd[i])
			dp_odd.append(0)
	dp_odd_right = [0]
	dp_even_right = [0]
	for i in range(n):
		idx = n - i - 1
		if s[idx] == 'R':
			dp_odd_right.append(1 + dp_even_right[i])
			dp_even_right.append(0)
		else:
			dp_even_right.append(1 + dp_odd_right[i])
			dp_odd_right.append(0)
	dp_odd_right.reverse()
	dp_even_right.reverse()
	res = ''
	for i in range(n + 1):
		res += str(dp_odd[i] + dp_odd_right[i] + 1) + ' '
	return res
num_test_cases = int(input())
for i in range(num_test_cases):
	n = int(input())
	s = input()
	print(journey(n, s))


import sys
input = lambda : sys.stdin.readline().rstrip()

def f(st):
	if st == 'L':
		return 0
	return 1
for _ in range(int(input())):
	n = int(input())
	S = list(map(f, input()))
	(L, R) = (list(range(n + 1)), list(range(n + 1)))
	(rL, rR) = (list(range(n + 1)), list(range(n + 1)))
	for i in range(n):
		if not S[i]:
			L[i + 1] = rL[i]
		if S[i]:
			rL[i + 1] = L[i]
		if S[n - 1 - i]:
			R[-2 - i] = rR[-1 - i]
		if not S[n - 1 - i]:
			rR[-2 - i] = R[-1 - i]
	Ans = [R[i] - L[i] + 1 for i in range(n + 1)]
	print(*Ans, sep=' ')


for testcase in range(int(input())):
	n = int(input())
	s = input()
	trav1 = []
	trav2 = []
	tick = False
	for i in s:
		tick = not tick
		if (i == 'L') ^ tick:
			trav1.append(1)
			trav2.append(0)
		else:
			trav1.append(0)
			trav2.append(1)
	dp1a = [0]
	dp1b = [0]
	inarow = 0
	for i in trav1:
		inarow = (inarow + 1) * i
		dp1a.append(inarow)
	trav1.reverse()
	inarow = 0
	for i in trav1:
		inarow = (inarow + 1) * i
		dp1b.append(inarow)
	dp1b.reverse()
	dp2a = [0]
	dp2b = [0]
	for i in trav2:
		inarow = (inarow + 1) * i
		dp2a.append(inarow)
	trav2.reverse()
	inarow = 0
	for i in trav2:
		inarow = (inarow + 1) * i
		dp2b.append(inarow)
	dp2b.reverse()
	ans = []
	for i in range(n + 1):
		if i % 2:
			ans.append(dp2a[i] + dp2b[i] + 1)
		else:
			ans.append(dp1a[i] + dp1b[i] + 1)
	print(' '.join(map(str, ans)))


def solve():
	n = int(input())
	s = list(map(lambda d: 0 if d == 'R' else 1, input()))
	right_span = [[1, 1] for _ in range(n + 1)]
	left_span = [[1, 1] for _ in range(n + 1)]
	assert len(s) == n
	for i in range(n - 1, -1, -1):
		right_span[i][0] = 1 + right_span[i + 1][1] if s[i] == 0 else 1
		right_span[i][1] = 1 + right_span[i + 1][0] if s[i] == 1 else 1
	for i in range(1, n + 1):
		left_span[i][0] = 1 + left_span[i - 1][1] if s[i - 1] == 1 else 1
		left_span[i][1] = 1 + left_span[i - 1][0] if s[i - 1] == 0 else 1
	print(' '.join(map(lambda x: str(x[0][0] + x[1][0] - 1), zip(left_span, right_span))))

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for _ in range(int(input())):
	n = int(input())
	s = input()
	i = 0
	prev = s[0]
	keylist = []
	flag = False
	while i < n:
		if s[i] != prev:
			flag = True
			keylist.append(i - 1)
		while s[i] != prev:
			prev = s[i]
			i += 1
			if i >= n:
				break
		if i >= n:
			keylist.append(n)
			break
		if flag:
			keylist.append(i)
		flag = False
		i += 1
	ans = [1] * (n + 1)
	for i in range(len(keylist) // 2):
		x = keylist[2 * i]
		y = keylist[2 * i + 1]
		if s[x] == 'L':
			for j in range(x + 1, y + 1, 2):
				ans[j] = y - x + 1
		else:
			for j in range(x, y + 1, 2):
				ans[j] = y - x + 1
	for i in range(n):
		if s[i] == 'L' and ans[i + 1] == 1:
			ans[i + 1] = 2
		if s[i] == 'R' and ans[i] == 1:
			ans[i] = 2
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	st = 'l' + input() + 'r'
	forw = [0 for i in range(n + 2)]
	back = [0 for i in range(n + 2)]
	i = 1
	while i <= n:
		if st[i] == 'R' and st[i + 1] == 'L':
			forw[i + 1] = forw[i - 1] + 2
			i += 2
		elif st[i] == 'L':
			forw[i] = 1
			i += 1
		else:
			i += 1
	i = n
	while i >= 1:
		if st[i] == 'L' and st[i - 1] == 'R':
			back[i - 1] = back[i + 1] + 2
			i -= 2
		elif st[i] == 'R':
			back[i] = 1
			i -= 1
		else:
			i -= 1
	for i in range(n + 1):
		print(forw[i] + back[i + 1] + 1, end=' ')
	print()


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import heapify, heappop, heappush
from statistics import median
from math import gcd, sqrt, floor, factorial, ceil, log2, log10
import copy
from copy import deepcopy
import sys
sys.setrecursionlimit(10 ** 7)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

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

def get_str_list():
	return list(input())

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

def get_int():
	return int(input())

def fun1(l):
	for i in range(n + 1):
		if i == 0:
			left[i] = 1
		elif i == 1:
			if l[i - 1] == 'L':
				left[1] = 2
			else:
				left[1] = 1
		elif l[i - 1] == 'L':
			if l[i - 2] == 'R':
				left[i] = 2 + left[i - 2]
			else:
				left[i] = 2
		else:
			left[i] = 1

def fun2(l):
	i = n
	while i >= 0:
		if i == n:
			right[i] = 1
		elif i == n - 1:
			if l[i] == 'R':
				right[i] = 2
			else:
				right[i] = 1
		elif l[i] == 'R':
			if l[i + 1] == 'L':
				right[i] = right[i + 2] + 2
			else:
				right[i] = 2
		else:
			right[i] = 1
		i -= 1
t = int(input())
for i in range(t):
	n = get_int()
	l = get_str_list()
	m = []
	for i in l:
		if i == 'L':
			m.append('R')
		else:
			m.append('L')
	left = defaultdict(int)
	right = defaultdict(int)
	fun1(m)
	fun2(m)
	for i in range(n + 1):
		count = 1
		if i == 0:
			if l[0] == 'R':
				count += right[1]
		elif i == n:
			if l[i - 1] == 'L':
				count += left[i - 1]
		else:
			if l[i] == 'R':
				count += right[i + 1]
			if l[i - 1] == 'L':
				count += left[i - 1]
		print(count, end=' ')
	print('')


def answer():
	a = [0] * (n + 1)
	for i in range(1, n + 1):
		if d[i - 1] == 'L':
			if i >= 2 and d[i - 2] == 'R':
				a[i] = a[i - 2] + 2
			else:
				a[i] = 1
	b = [0] * (n + 1)
	for i in range(n - 1, -1, -1):
		if d[i] == 'R':
			if i <= n - 2 and d[i + 1] == 'L':
				b[i] = b[i + 2] + 2
			else:
				b[i] = 1
	for i in range(n + 1):
		print(a[i] + b[i] + 1, end=' ')
for T in range(int(input())):
	n = int(input())
	d = input()
	answer()
	print()


from math import ceil

def main():
	T = int(input())
	for ___ in range(T):
		n = input().strip()
		n = int(n)
		d = input().strip()
		L = [-1 for i in range(n)]
		R = [-1 for i in range(n)]
		L[0] = 0
		R[n - 1] = n
		for i in range(1, n):
			if d[i] == d[i - 1]:
				L[i] = i
			else:
				L[i] = L[i - 1]
		for i in range(n - 2, -1, -1):
			if d[i] == d[i + 1]:
				R[i] = i + 1
			else:
				R[i] = R[i + 1]
		ans = [0 for i in range(n + 1)]
		if d[0] == 'R':
			ans[0] = R[0] + 1
		else:
			ans[0] = 1
		if d[n - 1] == 'L':
			ans[n] = n - L[n - 1] + 1
		else:
			ans[n] = 1
		for i in range(1, n):
			ans[i] = 1
			if d[i - 1] == 'L':
				ans[i] += i - L[i - 1]
			if d[i] == 'R':
				ans[i] += R[i] - i
		for item in ans:
			print(item, end=' ')
		print()
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	roads = list(input())
	ans = []
	lefts = [0 for i in range(n + 1)]
	rights = [0 for i in range(n + 1)]
	if roads[0] == 'L':
		lefts[1] = 1
	if roads[n - 1] == 'R':
		rights[n - 1] = 1
	for i in range(2, n + 1):
		if roads[i - 1] == 'L':
			if roads[i - 2] == 'L':
				lefts[i] = 1
			else:
				lefts[i] = lefts[i - 2] + 2
	for i in range(n - 2, -1, -1):
		if roads[i] == 'R':
			if roads[i + 1] == 'R':
				rights[i] = 1
			else:
				rights[i] = rights[i + 2] + 2
	for i in range(n + 1):
		ans.append(str(lefts[i] + rights[i] + 1))
	print(' '.join(ans))


import sys
import heapq
import math
from collections import deque
MOD = 1000000007

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def factor(n, l, d):
	F = False
	for p in l:
		if n % p == 0:
			if p in d:
				d[p] += 1
			else:
				d[p] = 1
			F = True
			break
	if F:
		factor(n // p, l, d)

def find(parent, i):
	if parent[i] != i:
		parent[i] = find(parent, parent[i])
	return parent[i]

def union(parent, rank, xx, yy):
	x = find(parent, xx)
	y = find(parent, yy)
	if rank[x] > rank[y]:
		parent[y] = x
	elif rank[y] > rank[x]:
		parent[x] = y
	else:
		parent[y] = x
		rank[x] += 1
ans = 0
n = int(sys.stdin.readline().strip())
dd = {'R': 'L', 'L': 'R'}
for testj in range(n):
	ans = 0
	c = 1.0
	pre = [0]
	k = int(sys.stdin.readline().strip())
	S = sys.stdin.readline().strip()
	L = [[0 for i in range(k + 1)] for t in range(2)]
	R = [[0 for i in range(k + 1)] for t in range(2)]
	LO = []
	LE = []
	for i in range(k):
		if i % 2 == 0:
			LO.append(dd[S[i]])
			LE.append(S[i])
		else:
			LO.append(S[i])
			LE.append(dd[S[i]])
	for i in range(k):
		if LE[i] == 'L':
			L[0][i + 1] = L[0][i] + 1
		else:
			L[0][i + 1] = 0
		if LE[k - 1 - i] == 'R':
			R[0][k - 1 - i] = R[0][k - i] + 1
		else:
			R[0][k - 1 - i] = 0
	for i in range(k):
		if LO[i] == 'L':
			L[1][i + 1] = L[1][i] + 1
		else:
			L[1][i + 1] = 0
		if LO[k - 1 - i] == 'R':
			R[1][k - 1 - i] = R[1][k - i] + 1
		else:
			R[1][k - 1 - i] = 0
	ans = []
	for i in range(k + 1):
		if i % 2 == 1:
			ans.append(str(L[0][i] + R[1][i] + 1))
		else:
			ans.append(str(L[1][i] + R[0][i] + 1))
	print(' '.join(ans))


import math, sys, bisect, heapq, os
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
from functools import lru_cache
int1 = lambda x: int(x) - 1

def input():
	return sys.stdin.readline().rstrip('\r\n')
aj = lambda : list(map(int, input().split()))

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])

def solve():
	for _ in range(int(input())):
		(n,) = aj()
		s = input()
		dp = [[0] * 2 for i in range(n)]
		if s[-1] == 'L':
			dp[-1][0] = 1
		else:
			dp[-1][1] = 1
		for i in range(n - 2, -1, -1):
			if s[i] == 'L':
				dp[i][0] = 1 + dp[i + 1][1]
				dp[i][1] = 0
			else:
				dp[i][0] = 0
				dp[i][1] = 1 + dp[i + 1][0]
		dp2 = [[0] * 2 for i in range(n)]
		if s[0] == 'L':
			dp2[0][0] = 1
		else:
			dp2[0][1] = 1
		for i in range(1, n):
			if s[i] == 'L':
				dp2[i][0] = 1 + dp2[i - 1][1]
				dp2[i][1] = 0
			else:
				dp2[i][0] = 0
				dp2[i][1] = 1 + dp2[i - 1][0]
		ans = [1] * (n + 1)
		ans[0] += dp[0][1]
		ans[-1] += dp2[-1][0]
		for i in range(1, n):
			ans[i] += dp2[i - 1][0]
			ans[i] += dp[i][1]
		print(*ans)
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
solve()


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	dp_l = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			if i - 2 >= 0 and s[i - 2] == 'R':
				dp_l[i] = dp_l[i - 2] + 2
			else:
				dp_l[i] = 1
		else:
			dp_l[i] = 0
	s = s[::-1]
	dp_r = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'R':
			if i - 2 >= 0 and s[i - 2] == 'L':
				dp_r[i] = dp_r[i - 2] + 2
			else:
				dp_r[i] = 1
		else:
			dp_r[i] = 0
	dp_r = dp_r[::-1]
	ans = [i + j + 1 for (i, j) in zip(dp_l, dp_r)]
	print(*ans)


class UnionFind:

	def __init__(self, n):
		self.parent = list(range(n))

	def find(self, a):
		acopy = a
		while a != self.parent[a]:
			a = self.parent[a]
		while acopy != a:
			(self.parent[acopy], acopy) = (a, self.parent[acopy])
		return a

	def union(self, a, b):
		self.parent[self.find(b)] = self.find(a)

def main():
	t = int(input())
	allAns = []
	for _ in range(t):
		n = int(input())
		odd = input()
		e = []
		for c in odd:
			if c == 'L':
				e.append('R')
			else:
				e.append('L')
		even = ''.join(e)
		nCities = n + 1
		visitedCity = [False for __ in range(nCities * 2)]
		uf = UnionFind(nCities * 2)
		for city in range(nCities):
			if visitedCity[city]:
				continue
			stack = [city]
			visitedCity[city] = True
			while stack:
				c = stack.pop()
				if 0 <= c < nCities - 1 and odd[c] == 'R' and (not visitedCity[c + 1 + nCities]):
					visitedCity[c + 1 + nCities] = True
					uf.union(c, c + 1 + nCities)
					stack.append(c + 1 + nCities)
				if 1 <= c < nCities and odd[c - 1] == 'L' and (not visitedCity[c - 1 + nCities]):
					visitedCity[c - 1 + nCities] = True
					uf.union(c, c - 1 + nCities)
					stack.append(c - 1 + nCities)
				if nCities <= c < 2 * nCities - 1 and even[c - nCities] == 'R' and (not visitedCity[c + 1 - nCities]):
					visitedCity[c + 1 - nCities] = True
					uf.union(c, c + 1 - nCities)
					stack.append(c + 1 - nCities)
				if nCities + 1 <= c < nCities and even[c - nCities - 1] == 'L' and (not visitedCity[c - 1 - nCities]):
					visitedCity[c - 1 - nCities] = True
					uf.union(c, c - 1 - nCities)
					stack.append(c - 1 - nCities)
		parentCityGroupCnts = [0 for _ in range(nCities * 2)]
		for i in range(nCities * 2):
			parentCityGroupCnts[uf.find(i)] += 1
		ans = [-1 for _ in range(nCities)]
		for i in range(nCities):
			ans[i] = parentCityGroupCnts[uf.find(i)]
		allAns.append(ans)
	multiLineArrayOfArraysPrint(allAns)
	return
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		S = list(input().strip())
		S_R = [''] * N
		S_L = [''] * N
		for i in range(N):
			if i % 2 == 1:
				S_L[i] = S[i]
				if S[i] == 'L':
					S_R[i] = 'R'
				else:
					S_R[i] = 'L'
			else:
				S_R[i] = S[i]
				if S[i] == 'L':
					S_L[i] = 'R'
				else:
					S_L[i] = 'L'
		ans = [1] * (N + 1)
		current_l = 0
		current_r = 0
		for i in range(N):
			if S_L[i] == 'L':
				current_l += 1
			else:
				current_l = 0
			if S_R[i] == 'L':
				current_r += 1
			else:
				current_r = 0
			if i % 2 == 0:
				ans[i + 1] += current_r
			else:
				ans[i + 1] += current_l
		current_l = 0
		current_r = 0
		for i in range(N - 1, -1, -1):
			if S_L[i] == 'R':
				current_l += 1
			else:
				current_l = 0
			if S_R[i] == 'R':
				current_r += 1
			else:
				current_r = 0
			if i % 2 == 0:
				ans[i] += current_r
			else:
				ans[i] += current_l
		print(*ans)
main()


import sys, os, io
input = sys.stdin.readline
T = int(input())
for t in range(T):
	n = int(input())
	S = input()[:-1]
	ans = [1] * (n + 1)
	r = [0] * (n + 1)
	if S[-1] == 'R':
		r[-2] = 1
	for i in range(n - 2, -1, -1):
		if S[i] == 'R':
			r[i] += 1
			if S[i + 1] == 'L':
				r[i] += 1 + r[i + 2]
	l = [0] * (n + 1)
	if S[0] == 'L':
		l[1] = 1
	for i in range(2, n + 1):
		if S[i - 1] == 'L':
			l[i] += 1
			if S[i - 2] == 'R':
				l[i] += 1 + l[i - 2]
	for i in range(n + 1):
		ans[i] += l[i] + r[i]
	print(*ans)


a = int(input())
for i in range(a):
	s = int(input())
	s = input()
	ans = []
	for i in range(len(s)):
		if s[i] == 'L':
			ans.append(1)
		else:
			ans.append(0)
	bac = []
	for i in range(len(ans)):
		if ans[i] == 0:
			bac.append(0)
			continue
		if i == 0 and ans[i] == 1:
			bac.append(1)
			continue
		if ans[i] == 1:
			if i >= 2:
				if bac[-1] == 0:
					bac.append(bac[-2] + 2)
				else:
					bac.append(1)
			elif ans[0] == 0:
				bac.append(2)
			else:
				bac.append(1)
	forw = [0 for i in range(len(ans))]
	for i in range(len(ans) - 2, -1, -1):
		if ans[i + 1] == 1:
			forw[i] = 0
			continue
		elif i + 2 <= len(ans) - 1 and ans[i + 2] == 1:
			forw[i] = forw[i + 2] + 2
		elif i + 2 <= len(ans) - 1 and ans[i + 2] == 0:
			forw[i] = 1
		elif i + 1 <= len(ans) - 1:
			if ans[i + 1] == 0:
				forw[i] = 1
			else:
				forw[i] = 0
	fin = [0 for i in range(len(forw) + 1)]
	for i in range(len(bac)):
		fin[i + 1] = bac[i] + forw[i] + 1
	cnt = 0
	for i in range(len(s)):
		if i % 2 == 0:
			if s[i] == 'R':
				cnt += 1
			else:
				break
		elif s[i] == 'L':
			cnt += 1
		else:
			break
	fin[0] = cnt + 1
	print(*fin)


for iter in range(int(input())):
	n = int(input())
	A = [i == 'L' for i in input()]
	B = [0] * (n + 1)
	B[1] = int(A[0])
	for i in range(2, n + 1):
		if A[i - 1] and A[i - 2]:
			B[i] = 1
		elif A[i - 1]:
			B[i] = 2 + B[i - 2]
		else:
			B[i] = 0
	C = [0] * (n + 1)
	C[-2] = 1 - int(A[-1])
	for i in range(n - 2, -1, -1):
		if A[i]:
			C[i] = 0
		elif A[i + 1]:
			C[i] = 2 + C[i + 2]
		else:
			C[i] = 1
	for i in range(n + 1):
		print(1 + B[i] + C[i], end=' ')
	print()


import collections
import string
import math
import copy
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
mo = 998244353

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return --1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo

def quickpower(a, n):
	res = 1
	while n:
		if n & 1:
			res = res * a % mo
		n >>= 1
		a = a * a % mo
	return res

def dis(a, b):
	return abs(a[0] - b[0]) + abs(a[1] - b[1])

def getpref(x):
	if x > 1:
		return x * (x - 1) >> 1
	else:
		return 0

def orafli(upp):
	primes = []
	marked = [False for i in range(upp + 3)]
	for i in range(2, upp):
		if not marked[i]:
			primes.append(i)
		for j in primes:
			if i * j >= upp:
				break
			marked[i * j] = True
			if i % j == 0:
				break
	return primes
t = int(input())
for ti in range(t):
	n = int(input())
	fa = [i for i in range(n + 1)]
	ans = [1 for i in range(n + 1)]
	s = input()
	p = 0
	carry = 0
	for i in range(n >> 1):
		ofs = i << 1
		if s[ofs:ofs + 2] == 'RL':
			fa[ofs + 2] = p
			ans[p] += 2
		elif s[ofs:ofs + 2] == 'RR':
			ans[p] += 1 + carry
			carry = 0
			p = ofs + 2
		elif s[ofs:ofs + 2] == 'LL':
			ans[p] += carry
			carry = 1
			p = ofs + 2
		elif s[ofs:ofs + 2] == 'LR':
			ans[p] += carry
			carry = 0
			p = ofs + 2
	if n & 1:
		if s[-1] == 'R':
			ans[fa[-2]] += 1
		ans[fa[-2]] += carry
	else:
		ans[fa[-1]] += carry
	p = 1
	carry = 0
	for i in range(n >> 1):
		ofs = (i << 1) + 1
		if s[ofs:ofs + 2] == 'RL':
			fa[ofs + 2] = p
			ans[p] += 2
		elif s[ofs:ofs + 2] == 'RR':
			ans[p] += 1 + carry
			carry = 0
			p = ofs + 2
		elif s[ofs:ofs + 2] == 'LL':
			ans[p] += carry
			carry = 1
			p = ofs + 2
		elif s[ofs:ofs + 2] == 'LR':
			ans[p] += carry
			carry = 0
			p = ofs + 2
	if s[0] == 'L':
		ans[fa[1]] += 1
	if n & 1 == 0:
		if s[-1] == 'R':
			ans[fa[-2]] += 1
		ans[fa[-2]] += carry
	else:
		ans[fa[-1]] += carry
	for (idx, i) in enumerate(fa):
		print(f'{ans[i]}' + ' \n'[idx == n], end='')


import sys
import math
input = sys.stdin.readline
t = int(input())
for test in range(t):
	n = int(input())
	s = input()
	r = []
	p = s[0]
	rad = 1
	r.append(0)
	for i in range(1, n):
		if s[i] == p:
			r.append(rad)
			rad = 1
		else:
			rad += 1
			p = s[i]
	r.append(rad)
	res = []
	k = 0
	for j in range(1, len(r)):
		if s[k] == 'L':
			res.append(r[j - 1] + 1)
		else:
			res.append(r[j] + 1)
		k += 1
		for i in range(1, r[j]):
			if s[k] == 'R':
				res.append(r[j] + 1)
			else:
				res.append(1)
			k += 1
	if s[k - 1] == 'R':
		res.append(1)
	else:
		res.append(r[-1] + 1)
	res2 = [str(s) for s in res]
	print(' '.join(res2))


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	n = int(input())
	s = input().strip()
	pre = [0] * (n + 1)
	suff = [0] * (n + 1)
	x = 1
	c = s[0]
	for i in range(1, n + 1):
		pre[i] = x
		if i < n:
			if s[i] != c:
				x += 1
				c = s[i]
			else:
				x = 1
				c = s[i]
	s1 = s[::-1]
	x = 1
	c = s1[0]
	for i in range(1, n + 1):
		suff[i] = x
		if i < n:
			if s1[i] != c:
				x += 1
				c = s1[i]
			else:
				x = 1
				c = s1[i]
	suff = suff[::-1]
	k = ''
	arr = []
	for i in range(n + 1):
		c = 0
		if i == 0:
			if s[i] == 'R':
				c += suff[i]
		elif i == n:
			if s[i - 1] == 'L':
				c += pre[i]
		else:
			if s[i - 1] == 'L':
				c += pre[i]
			if s[i] == 'R':
				c += suff[i]
		arr.append(str(c + 1))
	print(' '.join(arr))


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(input())
	ans = [1] * (n + 1)
	x = 'R'
	c = 0
	for i in range(n):
		if s[i] != x:
			c += 1
			x = s[i]
		else:
			c = 1
		if s[i] == 'L':
			ans[i + 1] += c
	x = 'L'
	c = 0
	for i in range(n - 1, -1, -1):
		if s[i] != x:
			c += 1
			x = s[i]
		else:
			c = 1
		if s[i] == 'R':
			ans[i] += c
	print(*ans)


from sys import stdin
from collections import defaultdict, deque
inpi = lambda : int(input())
inps = lambda : input()

def find(parent, x):
	while parent[x] != x:
		parent[x] = parent[parent[x]]
		x = parent[x]
	return x

def solve(n, s):
	parent = {(i, j): (i, j) for i in range(n + 1) for j in range(2)}
	for (i, c) in enumerate(s, start=1):
		t = c == 'L'
		(a, b) = (find(parent, (i, t ^ 1)), find(parent, (i - 1, t)))
		parent[a] = b
	count = defaultdict(int)
	for i in range(n + 1):
		for j in range(2):
			count[find(parent, (i, j))] += 1
	ans = []
	for i in range(n + 1):
		ans.append(str(count[find(parent, (i, 0))]))
	print(' '.join(ans))
for _ in range(inpi()):
	n = inpi()
	s = inps()
	solve(n, s)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *

def fun():
	n = ii1()
	s = input()
	maxleft = list(range(0, n + 1))
	maxright = list(range(0, n + 1))
	for i in range(n + 1):
		if i == 0 or s[i - 1] == 'R':
			maxleft[i] = i
		elif i == 1 or s[i - 2] == 'L':
			maxleft[i] = i - 1
		else:
			maxleft[i] = maxleft[i - 2]
	for i in range(n, -1, -1):
		if i == n or s[i] == 'L':
			maxright[i] = i
		elif i == n - 1 or s[i + 1] == 'R':
			maxright[i] = i + 1
		else:
			maxright[i] = maxright[i + 2]
	ans = [maxright[i] - maxleft[i] + 1 for i in range(n + 1)]
	print(*ans)
for _ in range(ii1()):
	fun()


from sys import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = input()
	(lft, rgt) = ([[0, 0]], [[0, 0]])
	for i in range(n):
		lft.append([0, 0])
		if s[i] == 'L':
			lft[-1][0] += lft[i][1] + 1
		else:
			lft[-1][1] += lft[i][0] + 1
	for i in range(n - 1, -1, -1):
		rgt.append([0, 0])
		if s[i] == 'R':
			rgt[-1][0] += rgt[n - 1 - i][1] + 1
		else:
			rgt[-1][1] += rgt[n - 1 - i][0] + 1
	rgt = rgt[::-1]
	ans = []
	for i in range(n + 1):
		ans.append(lft[i][0] + rgt[i][0] + 1)
	print(*ans)


import sys
import math
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

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

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
f = []

def factMod(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fact(n):
	global f
	f = [1 for i in range(n)]
	for i in range(1, n):
		f[i] = f[i - 1] * i

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncrMod(n, r, m):
	if r == 0:
		return 1
	if n < r:
		return 0
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def ncr(n, r):
	if r == 0:
		return 1
	if n < r:
		return 0
	return f[n] / (f[r] * f[n - r])

def nc2(n):
	return n * (n - 1) / 2

def main():
	D()

def A():
	t = pi()
	z = 0
	while z < t:
		z += 1
		[n, k] = ti()
		if n <= k:
			print(math.floor(k / n) + (1 if k % n != 0 else 0))
		elif n % k == 0:
			print(1)
		else:
			print(2)

def B():
	t = pi()
	z = 0
	while z < t:
		z += 1
		[n, k] = ti()
		p = ti()
		sm = [p[0] for i in range(n)]
		for i in range(1, n):
			sm[i] = sm[i - 1] + p[i]
		ans = 0
		for i in range(1, n):
			if 100 * p[i] > k * (sm[i - 1] + ans):
				ans += math.ceil((100 * p[i] - k * (sm[i - 1] + ans)) / k)
		print(int(ans))

def C():
	t = pi()
	while t:
		t -= 1
		n = pi()
		(c, a, b) = (ti(), ti(), ti())
		dp = [0 for i in range(n)]
		mx = 0
		for i in range(1, n):
			if a[i] != b[i]:
				dp[i] = max(c[i] + abs(a[i] - b[i]) + 1, dp[i - 1] - (abs(a[i] - b[i]) - 1) + c[i])
			else:
				dp[i] = c[i] + 1
			mx = max(mx, dp[i])
		print(mx)

def D():
	t = pi()
	while t:
		t -= 1
		(n, s) = (pi(), ts())
		even = s
		odd = ['' for i in range(n)]
		for i in range(n):
			odd[i] = 'L' if even[i] == 'R' else 'R'
		rightOdd = [1 for i in range(n + 1)]
		rightEven = [1 for i in range(n + 1)]
		for i in range(n - 1, -1, -1):
			if even[i] == 'R':
				rightEven[i] += rightOdd[i + 1]
			if odd[i] == 'R':
				rightOdd[i] += rightEven[i + 1]
		leftEven = [1 for i in range(n + 1)]
		leftOdd = [1 for i in range(n + 1)]
		for i in range(1, n + 1):
			if even[i - 1] == 'L':
				leftEven[i] += leftOdd[i - 1]
			if odd[i - 1] == 'L':
				leftOdd[i] += leftEven[i - 1]
		ans = [0 for i in range(n + 1)]
		for i in range(n + 1):
			if i == 0:
				if even[i] == 'R':
					ans[i] = rightOdd[i + 1] + 1
				else:
					ans[i] = 1
				continue
			if i == n:
				if even[i - 1] == 'L':
					ans[i] = leftOdd[i - 1] + 1
				else:
					ans[i] = 1
				continue
			if even[i] == 'R':
				ans[i] += rightOdd[i + 1]
			if even[i - 1] == 'L':
				ans[i] += leftOdd[i - 1]
			ans[i] += 1
		print(*ans)
main()


from math import ceil
from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	n = int(input())
	s = input().split()[0]
	pre = [0] * (n + 1)
	pos = [0] * (n + 1)
	opre = [0] * (n + 1)
	opos = [0] * (n + 1)
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			pre[i] = 1 + opre[i + 1]
			opre[i] = 0
		else:
			opre[i] = 1 + pre[i + 1]
			pre[i] = 0
	for i in range(n):
		if s[i] == 'L':
			pos[i + 1] = 1 + opos[i]
			opos[i + 1] = 0
		else:
			opos[i + 1] = 1 + pos[i]
			pos[i + 1] = 0
	for i in range(n + 1):
		print(pre[i] + pos[i] + 1, end=' ')
	print()
	t -= 1


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()[:-1]
	pre1 = [0]
	if s[0] == 'L':
		start = 'R'
	else:
		start = 'L'
	c = 0
	for i in s:
		if i != start:
			c += 1
			pre1.append(c)
		else:
			c = 1
			pre1.append(c)
		start = i
	pre2 = [0]
	s = s[::-1]
	if s[0] == 'L':
		start = 'R'
	else:
		start = 'L'
	c = 0
	for i in s:
		if i != start:
			c += 1
			pre2.append(c)
		else:
			c = 1
			pre2.append(c)
		start = i
	pre2 = pre2[::-1]
	vals = []
	s = s[::-1]
	for i in range(n + 1):
		if i == 0:
			if s[i] == 'L':
				vals.append(1)
			else:
				vals.append(pre2[i] + 1)
		elif i == n:
			if s[i - 1] == 'R':
				vals.append(1)
			else:
				vals.append(pre1[i] + 1)
		elif s[i - 1] == 'R' and s[i] == 'L':
			vals.append(1)
		elif s[i - 1] == 'R' and s[i] == 'R':
			vals.append(pre2[i] + 1)
		elif s[i - 1] == 'L' and s[i] == 'L':
			vals.append(pre1[i] + 1)
		else:
			vals.append(pre1[i] + pre2[i] + 1)
	print(*vals)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	S = input().strip()
	A = []
	for i in range(n):
		if i % 2 == 0:
			if S[i] == 'L':
				A.append(0)
			else:
				A.append(1)
		elif S[i] == 'L':
			A.append(1)
		else:
			A.append(0)
	LEFT = [1]
	RIGHT = [1]
	for i in range(1, n):
		if A[i] == A[i - 1]:
			LEFT.append(LEFT[-1] + 1)
		else:
			LEFT.append(1)
	for i in range(n - 2, -1, -1):
		if A[i] == A[i + 1]:
			RIGHT.append(RIGHT[-1] + 1)
		else:
			RIGHT.append(1)
	RIGHT.reverse()
	ANSL = []
	for i in range(n + 1):
		ANS = 0
		if i % 2 == 0:
			if i != 0 and A[i - 1] == 1:
				ANS += LEFT[i - 1]
			if i != n and A[i] == 1:
				ANS += RIGHT[i]
		else:
			if i != 0 and A[i - 1] == 0:
				ANS += LEFT[i - 1]
			if i != n and A[i] == 0:
				ANS += RIGHT[i]
		ANSL.append(ANS + 1)
	print(*ANSL)


for tt in range(int(input())):
	n = int(input())
	s = 'x' + input()
	cnt = 0
	a = [0] * (n + 1)
	b = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i] != s[i - 1]:
			a[i] = a[i - 1] + 1
		else:
			a[i] = 1
	for i in range(n, -1, -1):
		if i + 1 < n + 1 and s[i] != s[i + 1]:
			b[i] = b[i + 1] + 1
		else:
			b[i] = 1
	for i in range(n + 1):
		ans = 1
		if i + 1 < n + 1 and s[i + 1] == 'R':
			ans += b[i + 1]
		if s[i] == 'L':
			ans += a[i]
		print(ans, end=' ')
	print()


tc = int(input())
for t in range(tc):
	n = int(input())
	s = input()
	dpl = [i for i in range(n + 1)]
	dpr = [i for i in range(n + 1)]
	for i in range(n + 1):
		if i == 0 or s[i - 1] == 'R':
			dpl[i] = i
		elif i == 1 or s[i - 2] == 'L':
			dpl[i] = i - 1
		else:
			dpl[i] = dpl[i - 2]
	for i in range(n, -1, -1):
		if i == n or s[i] == 'L':
			dpr[i] = i
		elif i == n - 1 or s[i + 1] == 'R':
			dpr[i] = i + 1
		else:
			dpr[i] = dpr[i + 2]
	ans = [dpr[i] - dpl[i] + 1 for i in range(n + 1)]
	print(*ans)


def main():
	T = eval(input())
	for _ in range(T):
		N = eval(input())
		str = input()
		dp1 = [1] * N
		dp2 = [1] * N
		ans = [1] * (N + 1)
		for i in range(1, N):
			if str[i] != str[i - 1]:
				dp1[i] += dp1[i - 1]
		for i in range(N - 2, -1, -1):
			if str[i] != str[i + 1]:
				dp2[i] += dp2[i + 1]
		for i in range(N + 1):
			if i != N and str[i] == 'R':
				ans[i] += dp2[i]
			if i != 0 and str[i - 1] == 'L':
				ans[i] += dp1[i - 1]
		print(*ans)
main()


def calc():
	n = int(input())
	arr = input()
	ans_t = [0] * (n + 1)
	ans_n = [0] * (n + 1)
	for i in range(1, n + 1):
		if arr[i - 1] == 'L':
			ans_n[i] = ans_t[i - 1] + 1
			ans_t[i] = 0
		else:
			ans_n[i] = 0
			ans_t[i] = ans_n[i - 1] + 1
	ans = ans_n
	ans_t = [0] * (n + 1)
	ans_n = [0] * (n + 1)
	for i in range(1, n + 1):
		if arr[-i] == 'R':
			ans_n[-i - 1] = ans_t[-i] + 1
			ans_t[-i - 1] = 0
		else:
			ans_t[-i - 1] = ans_n[-i] + 1
			ans_n[-i - 1] = 0
	for i in range(n + 1):
		print(ans[i] + 1 + ans_n[i], end=' ')
	print()
t = int(input())
for i in range(t):
	calc()


for y in range(int(input())):
	n = int(input())
	s = input()
	a = [0] * (n + 1)
	b = [0] * (n + 1)
	for i in range(1, n + 1):
		if s[i - 1] == 'L':
			if i - 2 < 0:
				a[i] = 1
			elif a[i - 1] == 0:
				a[i] = a[i - 2] + 2
			else:
				a[i] = 1
		else:
			pass
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			if i + 2 > n:
				b[i] = 1
			elif b[i + 1] == 0:
				b[i] = b[i + 2] + 2
			else:
				b[i] = 1
		else:
			pass
	for i in range(n + 1):
		print(1 + a[i] + b[i], end=' ')
	print()


import sys
import math

def II():
	return int(sys.stdin.readline())

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

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod
for _ in range(II()):
	n = II()
	s = list(SI())
	dp = [1 for i in range(n + 1)]
	count = 0
	for i in range(n):
		if i == 0:
			if s[i] == 'L':
				dp[i + 1] += 1
			count = 1
		elif i != 0:
			if s[i] != s[i - 1]:
				count += 1
			else:
				count = 1
			if s[i] == 'L':
				dp[i + 1] += count
	count = 0
	for i in range(n - 1, -1, -1):
		if i == n - 1:
			if s[i] == 'R':
				dp[i] += 1
			count = 1
		elif i != n - 1:
			if s[i] != s[i + 1]:
				count += 1
			else:
				count = 1
			if s[i] == 'R':
				dp[i] += count
	print(*dp)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		s = list(input())
		ct = [1 for i in range(n + 1)]
		ct[-1] = 0
		for i in range(n - 2, -1, -1):
			if s[i] != s[i + 1]:
				ct[i] = 1 + ct[i + 1]
		ct1 = [1 for i in range(n + 1)]
		ct1[0] = 0
		for i in range(1, n):
			if s[i] != s[i - 1]:
				ct1[i + 1] = 1 + ct1[i]
		ans = []
		if s[0] == 'R':
			ans.append(ct[0] + 1)
		else:
			ans.append(1)
		for i in range(1, n):
			v = 1
			if s[i] == 'R':
				v = v + ct[i]
			if s[i - 1] == 'L':
				v = v + ct1[i]
			ans.append(v)
		if s[n - 1] == 'L':
			ans.append(ct1[-1] + 1)
		else:
			ans.append(1)
		print(*ans)
main()


import sys
input = sys.stdin.readline
import math
t = int(input())
for f in range(t):
	n = int(input())
	s = input().rstrip()
	change = [1] * (n + 1)
	i = 0
	while i < n:
		if s[i] == 'L':
			memo = i
			while True:
				if i >= n - 1:
					break
				elif s[i + 1] == s[i]:
					break
				i += 1
			a = i - memo + 1
			for j in range(memo + 1, i + 2, 2):
				change[j] += a
			i += 1
		elif s[i] == 'R':
			memo = i
			while True:
				if i >= n - 1:
					break
				elif s[i + 1] == s[i]:
					break
				i += 1
			a = i - memo + 1
			for j in range(memo, i + 2, 2):
				change[j] += a
			i += 1
	print(*change)


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
MOD = 1000000007

def si():
	return input()

def ii():
	return int(input())

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

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

def sout(v):
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1
t = ii()
while t:
	t -= 1
	n = ii()
	a = si()
	dp1 = [0 for _ in range(n + 1)]
	dp2 = [0 for _ in range(n + 1)]
	if n == 1:
		print('1 2' if a == 'L' else '2 1')
	else:
		dp1[1] = 1 if a[0] == 'L' else 0
		for i in range(2, n + 1):
			c = 0
			if a[i - 1] == 'L':
				c += 1
				if a[i - 2] == 'R':
					c += 1
					dp1[i] = dp1[i - 2]
			dp1[i] += c
		dp2[-2] = 1 if a[-1] == 'R' else 0
		for i in range(n - 2, -1, -1):
			c = 0
			if a[i] == 'R':
				c += 1
				if a[i + 1] == 'L':
					c += 1
					dp2[i] = dp2[i + 2]
			dp2[i] += c
		for i in range(n + 1):
			sout(dp1[i] + dp2[i] + 1)
		print()


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	dpl = [1 for i in range(n + 1)]
	dpr = [1 for i in range(n + 1)]
	for i in range(0, n):
		if s[i] == 'L':
			dpl[i + 1] += 1
			if i - 1 >= 0 and s[i - 1] == 'R':
				dpl[i + 1] += dpl[i - 1]
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			dpr[i] += 1
			if i + 1 <= n - 1 and s[i + 1] == 'L':
				dpr[i] += dpr[i + 2]
	for i in range(len(dpr)):
		print(dpr[i] + dpl[i] - 1, end=' ')
	print()


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	S = [c for c in stdin.readline()]
	LR_l2r = [0 for _ in range(n)]
	RL_l2r = [0 for _ in range(n)]
	LR_r2l = [0 for _ in range(n)]
	RL_r2l = [0 for _ in range(n)]
	LR_l2r[n - 1] = 1 if S[n - 1] == 'L' else 0
	RL_l2r[n - 1] = 1 if S[n - 1] == 'R' else 0
	LR_r2l[0] = 1 if S[0] == 'R' else 0
	RL_r2l[0] = 1 if S[0] == 'L' else 0
	for i in range(n - 2, -1, -1):
		if S[i] == 'L':
			LR_l2r[i] = 1 + RL_l2r[i + 1]
		else:
			RL_l2r[i] = 1 + LR_l2r[i + 1]
	for i in range(1, n):
		if S[i] == 'L':
			RL_r2l[i] = 1 + LR_r2l[i - 1]
		else:
			LR_r2l[i] = 1 + RL_r2l[i - 1]
	res = []
	for i in range(0, n + 1):
		curr = 1
		if i != 0:
			curr += RL_r2l[i - 1]
		if i != n:
			curr += RL_l2r[i]
		res.append(str(curr))
	print(' '.join(res))


def main():
	cases = int(input())
	ans_list = []
	for _ in range(cases):
		n = int(input())
		s = input()
		(l_odd, r_odd, l_even, r_even) = ([1], [1], [1], [1])
		for char in s:
			if char == 'L':
				l_even.append(l_odd[-1] + 1)
				l_odd.append(1)
			else:
				l_odd.append(l_even[-1] + 1)
				l_even.append(1)
		for char in s[::-1]:
			if char == 'R':
				r_even.append(r_odd[-1] + 1)
				r_odd.append(1)
			else:
				r_odd.append(r_even[-1] + 1)
				r_even.append(1)
		(r_even, r_odd) = (r_even[::-1], r_odd[::-1])
		ans = [0 for i in range(n + 1)]
		for i in range(n + 1):
			ans[i] = l_even[i] + r_even[i] - 1
		ans_list.append(ans)
	for lst in ans_list:
		print(' '.join(list(map(str, lst))))
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	r = input()
	d = [0] * (n + 1)
	for i in range(n + 1):
		if d[i] == 0:
			d[i] = 1
			if i != 0 and r[i - 1] == 'L':
				d[i] += 1
			if i != n:
				most_right = i
				flag = True
				while True:
					if most_right == n:
						break
					if flag and r[most_right] == 'R':
						most_right += 1
						d[i] += 1
						flag = False
					elif not flag and r[most_right] == 'L':
						most_right += 1
						d[i] += 1
						flag = True
					else:
						break
				for j in range(i + 2, most_right + 1, 2):
					d[j] = d[i]
	print(' '.join(map(str, d)))


import sys
r = sys.stdin.readline
for _ in range(int(r())):
	N = int(r())
	s = r().strip()
	dpl = [i for i in range(N + 1)]
	dpr = [i for i in range(N + 1)]
	for i in range(N + 1):
		if i == 0 or s[i - 1] == 'R':
			dpl[i] = i
		elif i == 1 or s[i - 2] == 'L':
			dpl[i] = i - 1
		else:
			dpl[i] = dpl[i - 2]
	for i in range(N, -1, -1):
		if i == N or s[i] == 'L':
			dpr[i] = i
		elif i == N - 1 or s[i + 1] == 'R':
			dpr[i] = i + 1
		else:
			dpr[i] = dpr[i + 2]
	ans = [dpr[i] - dpl[i] + 1 for i in range(N + 1)]
	print(*ans)


from collections import defaultdict
from itertools import accumulate
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	n = int(input())
	S = input().strip()
	dp1 = [1] * n
	for i in range(n - 2, -1, -1):
		if S[i] != S[i + 1]:
			dp1[i] = dp1[i] + dp1[i + 1]
	dp2 = [1] * n
	for i in range(1, n):
		if S[i] != S[i - 1]:
			dp2[i] = dp2[i] + dp2[i - 1]
	print(dp1[0] + 1 if S[0] == 'R' else 1, end=' ')
	for i in range(1, n):
		tmp1 = dp2[i - 1] if S[i - 1] == 'L' else 0
		tmp2 = dp1[i] if S[i] == 'R' else 0
		print(tmp1 + 1 + tmp2, end=' ')
	print(dp2[n - 1] + 1 if S[n - 1] == 'L' else 1)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	s = input().strip()
	ans = [1] * (n + 1)
	st1 = []
	for i in range(n):
		if s[i] == 'R':
			st1.append(i)
		if i < n - 1 and s[i] == s[i + 1] or i == n - 1:
			while st1:
				v = st1.pop()
				ans[v] += i + 1 - v
	st2 = []
	for i in range(n - 1, -1, -1):
		if s[i] == 'L':
			st2.append(i + 1)
		if i > 0 and s[i] == s[i - 1] or i == 0:
			while st2:
				v = st2.pop()
				ans[v] += v - i
	return ans
for _ in range(int(input())):
	print(*solve())


t = int(input())
while t != 0:
	n = int(input())
	s = input()
	right = [[0, 0] for i in range(n + 1)]
	left = [[0, 0] for i in range(n + 1)]
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'L':
			right[i][1] = 1 + right[i + 1][0]
		else:
			right[i][0] = 1 + right[i + 1][1]
	for i in range(1, len(s) + 1):
		if s[i - 1] == 'R':
			left[i][1] = 1 + left[i - 1][0]
		else:
			left[i][0] = 1 + left[i - 1][1]
	for i in range(n + 1):
		print(1 + left[i][0] + right[i][0], end=' ')
	print()
	t -= 1


import sys

def solve(N, dirs):
	ans = [1] * (N + 1)
	(l_key, r_key) = (0, 1)
	vis = {}

	def move(ori_idx, ori_turn):
		(l, r) = (ori_idx, ori_idx)
		idx = ori_idx
		turn = ori_turn
		while idx < N and (turn == 0 and dirs[idx] == 'R' or (turn == 1 and dirs[idx] == 'L')):
			turn = 1 - turn
			idx += 1
			r = idx
			key = (turn, idx, r_key)
			if key in vis:
				r = vis[key]
				break
		turn = ori_turn
		for i in range(ori_idx, r + 1, 1):
			key = (turn, i, r_key)
			if key in vis:
				break
			turn = 1 - turn
			vis[key] = r
		idx = ori_idx
		turn = ori_turn
		while idx > 0 and (turn == 0 and dirs[idx - 1] == 'L' or (turn == 1 and dirs[idx - 1] == 'R')):
			turn = 1 - turn
			idx -= 1
			l = idx
			key = (turn, idx, l_key)
			if key in vis:
				l = vis[key]
				break
		turn = ori_turn
		for i in range(ori_idx, l - 1, -1):
			key = (turn, i, l_key)
			if key in vis:
				break
			turn = 1 - turn
			vis[key] = l
		return str(r - l + 1)
	for i in range(N + 1):
		ans[i] = move(i, 0)
	return ' '.join(ans)
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	dirs = input().rstrip()
	ans = solve(N, dirs)
	print(ans)


import math

def solve(n, s):
	dpl = [i for i in range(n + 1)]
	dpr = [i for i in range(n + 1)]
	for i in range(n + 1):
		if i == 0 or s[i - 1] == 'R':
			dpl[i] = i
		elif i == 1 or s[i - 2] == 'L':
			dpl[i] = i - 1
		else:
			dpl[i] = dpl[i - 2]
	for i in range(n, -1, -1):
		if i == n or s[i] == 'L':
			dpr[i] = i
		elif i == n - 1 or s[i + 1] == 'R':
			dpr[i] = i + 1
		else:
			dpr[i] = dpr[i + 2]
	ans = [dpr[i] - dpl[i] + 1 for i in range(n + 1)]
	print(*ans)
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	solve(n, s)


for _ in range(int(input())):
	(n, s) = (int(input()), input())
	(dpl, dpr) = ([i for i in range(n + 1)], [i for i in range(n + 1)])
	for i in range(n + 1):
		if i == 0 or s[i - 1] == 'R':
			dpl[i] = i
		elif i == 1 or s[i - 2] == 'L':
			dpl[i] = i - 1
		else:
			dpl[i] = dpl[i - 2]
	for i in range(n, -1, -1):
		if i == n or s[i] == 'L':
			dpr[i] = i
		elif i == n - 1 or s[i + 1] == 'R':
			dpr[i] = i + 1
		else:
			dpr[i] = dpr[i + 2]
	print(*[dpr[i] - dpl[i] + 1 for i in range(n + 1)])


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def commonAllowedPrefix(s1, s2):
	for i in range(0, min(len(s1), len(s2))):
		if s1[i] > s2[i]:
			return i
	return min(len(s1), len(s2))
for xyz in range(0, int(input())):
	n = int(input())
	s = input()
	lft = [i for i in range(0, n + 1)]
	rgt = [i for i in range(0, n + 1)]
	lft[0] = 0
	if s[0] == 'L':
		lft[1] = 0
	for i in range(2, n + 1):
		if s[i - 1] == 'L' and s[i - 2] == 'R':
			lft[i] = lft[i - 2]
		elif s[i - 1] == 'L':
			lft[i] = i - 1
	rgt[n] = n
	if s[n - 1] == 'R':
		rgt[n - 1] = n
	for i in range(n - 2, -1, -1):
		if s[i] == 'R' and s[i + 1] == 'L':
			rgt[i] = rgt[i + 2]
		elif s[i] == 'R':
			rgt[i] = i + 1
	for i in range(0, n + 1):
		print(rgt[i] - lft[i] + 1, end=' ')
	print('')