There is a frog staying to the left of the string $s = s_1 s_2 \ldots s_n$ consisting of $n$ characters (to be more precise, the frog initially stays at the cell $0$). Each character of $s$ is either 'L' or 'R'. It means that if the frog is staying at the $i$-th cell and the $i$-th character is 'L', the frog can jump only to the left. If the frog is staying at the $i$-th cell and the $i$-th character is 'R', the frog can jump only to the right. The frog can jump only to the right from the cell $0$.

Note that the frog can jump into the same cell twice and can perform as many jumps as it needs.

The frog wants to reach the $n+1$-th cell. The frog chooses some positive integer value $d$ before the first jump (and cannot change it later) and jumps by no more than $d$ cells at once. I.e. if the $i$-th character is 'L' then the frog can jump to any cell in a range $[max(0, i - d); i - 1]$, and if the $i$-th character is 'R' then the frog can jump to any cell in a range $[i + 1; min(n + 1; i + d)]$.

The frog doesn't want to jump far, so your task is to find the minimum possible value of $d$ such that the frog can reach the cell $n+1$ from the cell $0$ if it can jump by no more than $d$ cells at once. It is guaranteed that it is always possible to reach $n+1$ from $0$.

You have to answer $t$ independent test cases.


-----Input-----

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

The next $t$ lines describe test cases. The $i$-th test case is described as a string $s$ consisting of at least $1$ and at most $2 \cdot 10^5$ characters 'L' and 'R'.

It is guaranteed that the sum of lengths of strings over all test cases does not exceed $2 \cdot 10^5$ ($\sum |s| \le 2 \cdot 10^5$).


-----Output-----

For each test case, print the answer — the minimum possible value of $d$ such that the frog can reach the cell $n+1$ from the cell $0$ if it jumps by no more than $d$ at once.


-----Example-----
Input
6
LRLRRLL
L
LLR
RRRR
LLLLLL
R

Output
3
2
3
1
7
1



-----Note-----

The picture describing the first test case of the example and one of the possible answers:

[Image]

In the second test case of the example, the frog can only jump directly from $0$ to $n+1$.

In the third test case of the example, the frog can choose $d=3$, jump to the cell $3$ from the cell $0$ and then to the cell $4$ from the cell $3$.

In the fourth test case of the example, the frog can choose $d=1$ and jump $5$ times to the right.

In the fifth test case of the example, the frog can only jump directly from $0$ to $n+1$.

In the sixth test case of the example, the frog can choose $d=1$ and jump $2$ times to the right.

Source: codeforces | Difficulty: EASY
Tags: Graph traversal

Sorting

Implementation

Greedy algorithms

Data structures


Solutions:
testcases = int(input())
for i in range(testcases):
	moves = input() + 'R'
	index = -1
	ans = 0
	for i in range(len(moves)):
		if moves[i] == 'R':
			ans = max(ans, i - index)
			index = i
	print(ans)


n_tests = int(input())
for _ in range(n_tests):
	str = input()
	prev = -1
	maxx = 0
	for i in range(len(str)):
		if str[i] == 'R':
			tmp = i - prev
			prev = i
			if tmp > maxx:
				maxx = tmp
	if len(str) - prev > maxx:
		maxx = len(str) - prev
	print(maxx)


for _ in range(int(input())):
	x = input()
	p = 0
	x = x.replace('R', ' ').split()
	if len(x) == 0:
		print(1)
	else:
		for i in x:
			p = max(p, len(i))
		print(p + 1)


for _ in range(int(input())):
	s = input()
	s = s.split('R')
	s = [len(x) for x in s]
	print(max(s) + 1)


for case in range(int(input())):
	string = input()
	ds = []
	d = 1
	lastl = None
	for (i, l) in enumerate(string):
		if l == 'R':
			d = 1
			ds.append(d)
		elif i == len(string) - 1:
			if l == 'L':
				d += 1
			ds.append(d)
		else:
			d += 1
			ds.append(d)
	print(max(ds))


t = int(input())
for _ in range(t):
	s = input().strip()
	flag = False
	biggest = 0
	count = 0
	for i in s:
		if i == 'L':
			count += 1
		else:
			if count > biggest:
				biggest = count
			count = 0
	if count > biggest:
		biggest = count
	print(biggest + 1)


t = int(input())
while t:
	t = t - 1
	s = input()
	b = [0]
	for i in range(0, len(s)):
		if s[i] == 'R':
			b.append(i + 1)
	b.append(len(s) + 1)
	ans = 0
	for i in range(0, len(b) - 1):
		ans = max(ans, b[i + 1] - b[i])
	print(ans)


for _ in range(int(input())):
	s = input()
	a = sorted(list(set(s.split('R'))), reverse=True)
	print(len(a[0]) + 1)


querys = int(input())
while querys != 0:
	querys -= 1
	movements = list(input())
	j = 0
	max = 0
	find = False
	temp = 0
	while j < len(movements):
		if movements[j] == 'L':
			find = True
		else:
			find = False
			temp = 0
			j += 1
			continue
		if find:
			temp += 1
		if temp > max:
			max = temp
		j += 1
	print(max + 1)


for _ in range(int(input())):
	hops = []
	move = input()
	size = len(move)
	(first, second) = (move.find('R'), move.rfind('R'))
	if first + second < 0:
		print(size + 1)
	elif first == second:
		print(max(first + 1, size - second))
	else:
		hops.append((first + 1, first))
		for (x, y) in enumerate(move):
			if y == 'R':
				hops.append((x + 1 - hops[-1][1], x + 1))
		hops.append((size - second, second))
		print(max(hops)[0])


import sys, math
sys.setrecursionlimit(10 ** 5 + 10)

def input():
	return sys.stdin.readline()[:-1]

def main():
	q = int(input())
	for _ in range(q):
		s = 'R' + input() + 'R'
		t = list(s.split('R'))
		ans = 0
		for e in t:
			ans = max(ans, len(e) + 1)
		print(ans)
main()


t = int(input())
for ti in range(t):
	li = input()
	dst = 1
	last = -1
	l = 0
	ml = 0
	for (idx, i) in enumerate(li):
		if i == 'L':
			l += 1
			ml = max(l, ml)
		else:
			l = 0
	print(ml + 1)


t = int(input())

def dist(seq=''):
	distance = 1
	dist_max = 1
	for i in seq:
		if i == 'R':
			if distance > dist_max:
				dist_max = distance
			distance = 1
		if i == 'L':
			distance += 1
	if distance > dist_max:
		dist_max = distance
	return dist_max
for row in range(t):
	c = input()
	print(dist(c))


num_de_testes = int(input())
for i in range(num_de_testes):
	caso_de_teste = input()
	(aux, valor_min, i) = (1, 0, 0)
	while i < len(caso_de_teste):
		if caso_de_teste[i] != 'R':
			aux += 1
		else:
			if aux > valor_min:
				valor_min = aux
			aux = 1
		i += 1
	if aux > valor_min:
		valor_min = aux
	print(valor_min)


def main():
	import sys
	input = sys.stdin.readline
	for _ in range(int(input())):
		S = input().rstrip('\n')
		cnt = 0
		ans = 1
		for s in S:
			if s == 'L':
				cnt += 1
				ans = max(ans, cnt + 1)
			else:
				cnt = 0
		print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
for _ in range(n):
	s = input()
	LL = 0
	need = 0
	for i in s:
		if i == 'L':
			LL += 1
		else:
			need = max(need, LL)
			LL = 0
		need = max(need, LL)
	print(need + 1)


for i in range(int(input())):
	s = input()
	l = ['R'] + list(s)
	maxx = 0
	prev = 0
	for i in range(1, len(l)):
		if l[i] == 'R':
			d = i - prev
			prev = i
			if d >= maxx:
				maxx = d
	maxx = len(l) if maxx == 0 else maxx
	for i in range(len(l) - 1, -1, -1):
		if l[i] == 'R':
			mdfc = len(l) - i
			break
	print(mdfc if mdfc > maxx else maxx)


T = int(input())
for t in range(T):
	A = input()
	n = len(A)
	B = [0]
	for i in range(n):
		if A[i] == 'R':
			B.append(i + 1)
	B.append(n + 1)
	ans = 0
	for i in range(len(B) - 1):
		ans = max(ans, B[i + 1] - B[i])
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	m = -1
	ans = 0
	for i in range(n):
		if s[i] == 'R':
			ans = max(i - m, ans)
			m = i
	print(max(ans, n - m))


for _ in range(int(input())):
	strr = input()
	b = [0]
	k = 0
	maxx = b[k]
	for i in range(len(strr)):
		if strr[i] == 'R':
			b.append(i + 1)
			if b[k + 1] - b[k] > maxx:
				maxx = b[k + 1] - b[k]
			k = k + 1
		if i == len(strr) - 1:
			b.append(len(strr) + 1)
			if b[k + 1] - b[k] > maxx:
				maxx = b[k + 1] - b[k]
			k = k + 1
	print(maxx)


n = int(input())
for i in range(n):
	jumps = list(input())
	l = 0
	r = 1
	count = 1
	while l < len(jumps) and r < len(jumps):
		if jumps[l] != jumps[r]:
			if jumps[l] == 'L':
				count = max(count, 1 + r - l)
			l = r
		r += 1
	if jumps[l] == 'L':
		count = max(count, 1 + r - l)
	print(count)


for i in range(int(input())):
	distance = 0
	dummy = []
	lineup = [0] + list(input()) + [0]
	for i in lineup:
		if i == 0 or i == 'R':
			dummy.append(distance)
			distance = 0
		else:
			distance += 1
	print(max(dummy) + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input()
	(d, dPos) = (0, 0)
	for i in range(len(s) - 1):
		if s[i] == 'R':
			if i + 1 - dPos > d:
				d = i + 1 - dPos
			dPos = i + 1
	if len(s) - dPos > d:
		d = len(s) - dPos
	print(d)


t = int(input())
while t > 0:
	b = input()
	a = '{}{}{}'.format('R', b, 'R')
	n = len(a)
	h = 0
	Max = 0
	for i in range(n):
		if a[i] == 'R':
			k = i - h
			if k > Max:
				Max = k
			h = i
	print(Max)
	t -= 1


for _ in range(int(input(''))):
	s = list(input(''))
	dp = [0] * (len(s) + 1)
	n = len(s)
	for j in range(n):
		if s[j] == 'L':
			dp[j + 1] = dp[j] + 1
	for i in range(n + 1):
		dp[i] += 1
	print(max(dp))


def solve():
	str = input()
	ans = []
	ans.append(0)
	for i in range(len(str)):
		if str[i] == 'R':
			ans.append(i + 1)
	ans.append(len(str) + 1)
	res = 0
	for i in range(len(ans)):
		if i == 0:
			continue
		if ans[i] - ans[i - 1] > res:
			res = ans[i] - ans[i - 1]
	return res
t = int(input())
while t > 0:
	print(solve())
	t -= 1


t = int(input())
for i in range(t):
	s = list(input().strip())
	r = 0
	t = 0
	for j in range(len(s)):
		if s[j] == 'L':
			t = t + 1
		else:
			if t > r:
				r = t
			t = 0
	if t > r:
		r = t
	print(r + 1)


for _ in range(int(input())):
	s = 'R' + input()
	prev = 0
	max_dist = 0
	for i in range(len(s)):
		if s[i] == 'R':
			max_dist = max(max_dist, i - prev)
			prev = i
	max_dist = max(max_dist, len(s) - prev)
	print(max_dist)


from __future__ import division, print_function

def get_ints():
	return map(int, input().strip().split())

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

def main():
	for _ in range(int(input())):
		s = input()
		arr = list(s)
		(cnt, res) = (-1, [0])
		for i in range(len(arr)):
			if arr[i] == 'R':
				res.append(i + 1)
		res.append(len(s) + 1)
		for i in range(len(res) - 1):
			cnt = max(cnt, res[i + 1] - res[i])
		print(cnt)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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()


from bisect import bisect_left, bisect_right

def go():
	s = input()
	prev = -1
	mx = 0
	for (i, aa) in enumerate(s):
		if aa == 'R':
			mx = max(mx, i - prev)
			prev = i
	return max(mx, len(s) - prev)
t = int(input())
for _ in range(t):
	print(go())


t = int(input())
for _ in range(t):
	s = input()
	s = s + 'R'
	max_d = 1
	akt_d = 1
	predosle_R = True
	for smer in s:
		if smer == 'L' and (not predosle_R):
			akt_d = akt_d + 1
		if smer == 'L' and predosle_R:
			akt_d = 1
			predosle_R = False
		if smer == 'R' and (not predosle_R):
			akt_d = akt_d + 1
			max_d = max(akt_d, max_d)
			predosle_R = True
	print(max_d)


tests = int(input())
for test in range(tests):
	s = input()
	ans = 0
	cur = 0
	for c in s:
		if c == 'R':
			ans = max(cur, ans)
			cur = 0
		else:
			cur += 1
	ans = max(cur, ans)
	print(ans + 1)


for _ in range(int(input())):
	s = 'R' + input()
	m = 0
	r = True
	t = 0
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R' and r == False:
			r = True
			m = max(t, m)
			t = 0
		elif s[i] == 'L':
			r = False
			t += 1
	print(m + 1)


t = int(input())
for i in range(t):
	ar = input()
	m = 0
	p = -1
	for i in range(len(ar)):
		if ar[i] == 'R':
			m = max(m, i - p)
			p = i
	m = max(m, len(ar) - p)
	print(m)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

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

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

def conv(x):
	return bin(x).replace('0b', '')
for t in range(int(data())):
	s = input()
	ans = 0
	k = -1
	for i in range(len(s)):
		if s[i] == 'R':
			ans = max(ans, i - k)
			k = i
	ans = max(ans, len(s) - k)
	print(ans)


t = int(input())
M = []

def fonction(s):
	if 'L' not in s:
		return 1
	elif 'R' not in s:
		return len(s) + 1
	else:
		L = s.split('R')
		return len(max(L)) + 1
for i in range(t):
	s = input()
	M.append(fonction(s))
for k in M:
	print(k)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	l = list(map(len, z().split('R')))
	print(max(l) + 1)


for _ in range(int(input())):
	a = input()
	c = 1
	m = []
	z = 0
	for j in a:
		if j == 'L':
			c += 1
		else:
			if c:
				m.append(c)
			c = 1
	if c:
		m.append(c)
	print(max(m))


for _ in range(int(input())):
	s = input() + 'R'
	n = len(s)
	(ans, tmp) = (0, 0)
	for i in s:
		if i == 'L':
			tmp += 1
		else:
			ans = max(ans, tmp)
			tmp = 0
	print(ans + 1)


for _ in range(int(input())):
	l = input()
	maxi = 0
	current = l[0]
	i = 0
	value = 0
	while i < len(l):
		if l[i] == 'L':
			value += 1
		else:
			value = 0
		i += 1
		maxi = max(value, maxi)
	print(maxi + 1)


t = int(input())
for i in range(t):
	s = input()
	last = s[0]
	count = 1
	mx = 1
	for j in range(1, len(s)):
		if last == s[j] and last == 'L':
			count += 1
		else:
			count = 1
		if count > mx:
			mx = count
		last = s[j]
	if 'L' in s:
		print(mx + 1)
	else:
		print(1)


for i in range(int(input())):
	s = input()
	last = s[0]
	r = 0 if last == 'R' else 1
	l = 0
	for i in s[1:]:
		if i == 'R':
			if r > l:
				l = r
			r = 0
		else:
			r += 1
	if s[-1] != 'R':
		if r > l:
			l = r
	print(l + 1)


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	s = I()
	s = s[0:len(s) - 1]
	if 'R' not in s:
		ans += '{}\n'.format(len(s) + 1)
	elif 'L' not in s:
		ans += '{}\n'.format(1)
	else:
		r = []
		i = 0
		j = i
		while i < len(s) and j < len(s):
			if s[i] == 'R':
				j = i + 1
				while j < len(s):
					if s[j] == 'R':
						r.append(j - i)
						break
					j += 1
			i += 1
		r.append(s.index('R') + 1)
		r.append(s[::-1].index('R') + 1)
		ans += '{}\n'.format(max(r))
print(ans)


def solve(frog):
	diff = [0]
	arr = []
	for (i, v) in enumerate(frog):
		if v == 'R':
			diff.append(i + 1)
	diff.append(len(frog) + 1)
	ans = 0
	for i in range(len(diff) - 1):
		ans = max(ans, diff[i + 1] - diff[i])
	return ans
for _ in range(int(input())):
	frog = input()
	print(solve(frog))


t = int(input())
strings = []
for x in range(t):
	strings.append(input())
for string in strings:
	cont = 1
	resp = 1
	for c in string:
		if c == 'L':
			cont += 1
		else:
			resp = max(cont, resp)
			cont = 1
	resp = max(cont, resp)
	print(resp)


n = int(input())
for j in range(n):
	maxi = -1
	prev = 0
	a = '0'
	a += str(input())
	for i in range(len(a)):
		if a[i] == 'R':
			if i - prev > maxi:
				maxi = i - prev
			prev = i
	if len(a) - prev > maxi:
		maxi = len(a) - prev
	print(maxi)


for _ in range(int(input())):
	s = input()
	a = t = 0
	res = 'R' + s + 'R'
	for i in range(len(res)):
		if res[i] == 'R':
			if a < i - t:
				a = i - t
			t = i
	print(a)


t = int(input())
for i in range(0, t):
	x = []
	s = input()
	for j in range(0, len(s)):
		if s[j] == 'R':
			x.append(j + 1)
		else:
			continue
	if len(x) == 0:
		print(len(s) + 1)
	else:
		y = [x[0], len(s) + 1 - x[len(x) - 1]]
		for j in range(0, len(x) - 1):
			c = x[j + 1] - x[j]
			y.append(c)
		print(max(y))


from sys import stdin

def main():
	readline = stdin.readline
	t = int(readline())
	res = []
	for i in range(t):
		s = readline().strip()
		count = 0
		max_count = 0
		l_flag = False
		for j in range(len(s)):
			if s[j] == 'L' and l_flag == False:
				l_flag = True
				count += 1
				if j == len(s) - 1:
					max_count = max(count, max_count)
			elif s[j] == 'L' and l_flag:
				count += 1
				if j == len(s) - 1:
					max_count = max(count, max_count)
			elif s[j] == 'R' and l_flag:
				max_count = max(count, max_count)
				l_flag == False
				count = 0
		res.append(max_count + 1)
	for i in range(t):
		print(res[i])
main()


test_case = int(input())
while test_case:
	list = input()
	list = 'L' + list + 'R'
	closest_r = 0
	dist = 0
	for i in range(len(list)):
		if list[i] == 'R':
			dist = max(dist, i - closest_r)
			closest_r = i
	print(dist)
	test_case -= 1


t = int(input())
for i in range(t):
	s = input()
	flag = True
	c = 0
	mi = 1
	for i in range(len(s)):
		if flag and s[i] == 'L':
			c = 2
			flag = False
		elif not flag and s[i] == 'L':
			c += 1
		elif not flag and s[i] == 'R':
			flag = True
			if mi < c:
				mi = c
		else:
			pass
	if mi < c:
		mi = c
	print(mi)


def solve(s):
	max_diff = 0
	prev_idx = -1
	s = s + 'D'
	s = 'S' + s
	n = len(s)
	for i in range(0, n):
		if s[i] == 'S':
			prev_idx = i
		elif s[i] == 'R':
			max_diff = max(max_diff, i - prev_idx)
			prev_idx = i
		elif s[i] == 'D':
			max_diff = max(max_diff, i - prev_idx)
	return max_diff
t = int(input())
results = list()
for _ in range(0, t):
	s = input()
	results.append(solve(s))
for result in results:
	print(result)


n1 = int(input())
for u in range(n1):
	s = input()
	mq = 0
	m = 0
	mqe = ''
	for i in s:
		if i == 'L':
			mq += 1
			if mq > m:
				m = mq
		else:
			mq = 0
	print(m + 1)


for _ in range(int(input())):
	a = list(input())
	k = 0
	shit = 0
	for i in a:
		if i == 'L':
			k += 1
		else:
			if k > shit:
				shit = k
			k = 0
	if k > shit:
		shit = k
	print(shit + 1)


import sys
input = sys.stdin.readline
tc = int(input())
for i in range(tc):
	s = input().rstrip()
	n = len(s)
	m = 0
	i = 0
	while i < n:
		j = i
		while j < n and s[j] == 'L':
			j += 1
		m = max(j - i, m)
		i = j + 1
	print(m + 1)


for _ in range(int(input())):
	s = input()
	le = 0
	m = 0
	for i in s:
		if i == 'L':
			le += 1
		else:
			if le > m:
				m = le
			le = 0
		if le > m:
			m = le
	print(m + 1)


cases = int(input())
for _ in range(cases):
	jumps = input()
	max_jump = 1
	prev_r = -1
	for i in range(len(jumps)):
		if jumps[i] == 'R':
			max_jump = max(i - prev_r, max_jump)
			prev_r = i
	max_jump = max(max_jump, len(jumps) - prev_r)
	print(max_jump)


def jump(arr):
	pos = []
	pos.append(0)
	for (i, ch) in enumerate(arr):
		if ch == 'R':
			pos.append(i + 1)
	pos.append(len(arr) + 1)
	ans = 0
	for i in range(len(pos) - 1):
		ans = max(ans, pos[i + 1] - pos[i])
	return ans
n = int(input())
for _ in range(n):
	s = list(input())
	print(jump(s))


def check(S, X):
	N = len(S)
	I = -1
	while I < N:
		if N <= X + I:
			return True
		P = False
		for j in range(1, X + 1):
			if S[I + j] == 'R':
				I += j
				P = True
				break
		if not P:
			return False
for _ in range(int(input())):
	S = input()
	L = 1
	R = len(S) + 1
	while L < R:
		M = (L + R) // 2
		if check(S, M):
			R = M
		else:
			L = M + 1
	print(L)


for _ in range(int(input())):
	s = input()
	a = []
	count = 0
	for i in range(0, len(s)):
		if s[i] == 'L' and count == 0:
			count = 1
		elif s[i] == 'L' and count > 0:
			count += 1
		else:
			a.append(count)
			count = 0
	if count > 0:
		a.append(count)
	print(max(a) + 1)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	s = input() + 'R'
	n = len(s)
	ans = 0
	prev = -1
	for i in range(n):
		if s[i] == 'R':
			ans = max(ans, i - prev)
			prev = i
	print(ans if ans != 0 else n + 1)


import sys
for i in range(int(sys.stdin.readline())):
	s = sys.stdin.readline().strip()
	s += 'R'
	m = 0
	lc = 1
	for j in s:
		if j == 'L':
			lc += 1
			continue
		m = max(lc, m)
		lc = 1
	print(m)


a = int(input())
for _ in range(a):
	l = input() + 'R'
	x = 0
	m = 0
	for i in range(len(l)):
		if l[i] == 'L':
			x += 1
		else:
			m = max(m, x)
			x = 0
	print(m + 1)


t = int(input())
for t1 in range(0, t):
	s1 = input()
	n = len(s1)
	f = 0
	flag = -1
	ok = 0
	for i in range(0, n):
		if s1[i] == 'L':
			f = f + 1
			ok = 0
		else:
			flag = max(flag, f)
			f = 0
			ok = 1
	if ok == 0:
		flag = max(flag, f)
	if flag == -1:
		print(n + 1)
	else:
		print(flag + 1)


for _ in range(int(input())):
	(a, b) = (0, 0)
	s = input()
	for i in s:
		if i == 'L':
			a += 1
		elif a == 0 or a == b:
			a = 0
			continue
		else:
			b = max(b, a)
			a = 0
	print(max(a, b) + 1)


t = int(input())
for query in range(t):
	j = list(input())
	y = 0
	z = 1
	j.append('R')
	for x in j:
		if x == 'R':
			if z > y:
				y = z
				z = 1
			else:
				z = 1
		else:
			z = z + 1
	print(y)


T = int(input())
for test in range(T):
	max = -1
	count = 0
	lst = ['R']
	lst.extend(list(input()))
	lst.append('R')
	for i in range(len(lst)):
		if lst[i] == 'R':
			if max < count:
				max = count
			count = 0
		else:
			count += 1
	print(max + 1)


t = int(input())
for test in range(t):
	s = input()
	r = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(len(s) + 1)
	maximum = 0
	for i in range(1, len(r)):
		maximum = max(maximum, r[i] - r[i - 1])
	print(maximum)


from math import ceil, gcd
from bisect import bisect_left as bl
from bisect import bisect_right as br
from array import array
from collections import Counter as ctr

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

def arr(a):
	return array('i', a)

def solve():
	for _ in range(int(input())):
		s = input()
		b = s.split('R')
		print(max((len(x) for x in b)) + 1)
solve()


t = int(input())
for i in range(1, t + 1, 1):
	s = input().split('R')
	print(len(max(s)) + 1)


def get_longest(s):
	c = 0
	m = 0
	for i in range(0, len(s)):
		if s[i] == 'L':
			c += 1
		else:
			if c > m:
				m = c
			c = 0
	if c > m:
		m = c
	return m
t = int(input())
while t:
	z = input()
	if 'R' not in z:
		print(len(z) + 1)
	elif 'L' not in z:
		print(1)
	else:
		r = get_longest(z)
		print(r + 1)
	t -= 1


for _ in range(int(input())):
	s = input().strip() + 'R'
	n = len(s)
	dr = -1
	d = 0
	for (i, j) in enumerate(s):
		if j == 'R':
			d = max(d, i - dr)
			dr = i
	print(d)


for _ in range(int(input())):
	string = input()
	lis = string.split('R')
	maxi = 0
	for i in lis:
		if maxi < len(i):
			maxi = len(i)
	print(maxi + 1)


for _ in range(int(input())):
	s = list(input())
	d = 0
	r = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(len(s) + 1)
	for i in range(1, len(r)):
		if r[i] - r[i - 1] > d:
			d = r[i] - r[i - 1]
	print(d)


a = int(input())
for p in range(a):
	flag = 0
	h = 0
	c = input()
	b = len(c)
	for i in range(b):
		if c[i] == 'L':
			flag = flag + 1
		else:
			if flag >= h:
				h = flag
			flag = 0
	print(max(h + 1, flag + 1))


def main():
	for _ in range(int(input())):
		s = input()
		rl = [0]
		for i in range(len(s)):
			if s[i] == 'R':
				rl += [i + 1]
		rl += [len(s) + 1]
		ans = 0
		for i in range(len(rl) - 1):
			ans = max(ans, rl[i + 1] - rl[i])
		print(ans)
main()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	i = 0
	m = 0
	k = 0
	while i < n:
		if s[i] == 'L':
			m = m + 1
			k = max(m, k)
		else:
			m = 0
			k = max(m, k)
		i = i + 1
	print(k + 1)


for _ in range(int(input())):
	s = input()
	ans = 0
	l = 0
	for i in range(len(s)):
		if s[i] == 'R':
			ans = max(ans, l + 1)
			l = 0
		if s[i] == 'L':
			l += 1
	ans = max(ans, l + 1)
	print(ans)


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	n = len(s)
	i = 0
	ans = 0
	while i < n:
		if s[i] == 'L':
			c = 1
			j = i + 1
			while j < n and s[j] == 'L':
				c = c + 1
				j = j + 1
			ans = max(ans, c)
			i = j
		else:
			i = i + 1
	print(ans + 1)


t = int(input())
for j in range(t):
	s = input()
	count = 0
	max_l = []
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		else:
			max_l.append(count)
			count = 0
	max_l.append(count)
	if max(max_l) == 0:
		print(1)
	else:
		print(max(max_l) + 1)


num_inp = lambda : int(input())
arr_inp = lambda : list(map(int, input().split()))
sp_inp = lambda : map(int, input().split())
str_inp = lambda : input()
t = int(input())
for _ in range(t):
	s = input()
	k = s.split('R')
	print(len(max(k)) + 1)


for _ in range(int(input())):
	s = input()
	ans = 1
	c = 1
	n = len(s)
	for i in range(n - 1, -1, -1):
		if s[i] == 'R':
			if c > ans:
				ans = c
			c = 1
		else:
			c = c + 1
	if c > ans:
		ans = c
	print(ans)


for _ in range(int(input())):
	s = input()
	if s.count('R') == 0:
		print(len(s) + 1)
	else:
		l = []
		l.append(0)
		for i in range(len(s)):
			if s[i] == 'R':
				l.append(i + 1)
		l.append(len(s) + 1)
		max = 0
		for i in range(len(l) - 1):
			if l[i + 1] - l[i] > max:
				max = l[i + 1] - l[i]
		print(max)


for _ in range(int(input())):
	s = input()
	s += 'R'
	n = len(s)
	c = 0
	l = []
	for i in range(n):
		if s[i] == 'L':
			c += 1
		else:
			l.append(c)
			c = 0
	if len(l) == 0:
		print('1')
	else:
		print(max(l) + 1)


t = int(input())
for k in range(t):
	a = []
	s = input()
	n = len(s)
	i = 0
	count = 0
	while i < n:
		count = 0
		if s[i] == 'L':
			count += 1
			j = i + 1
			while j < n:
				if s[j] == 'L':
					count += 1
				else:
					break
				j += 1
			a.append(count)
			i = j
		elif s[i] == 'R':
			i = i + 1
	if len(a) == 0:
		print(1)
		continue
	ans = max(a)
	print(ans + 1)


t = int(input())
for i in range(t):
	ch = input()
	L = [len(j) for j in ch.split('R')]
	print(max(L) + 1)


def length(string):
	maxl = 0
	l = 0
	for ele in string:
		if ele == 'R':
			l = 0
		else:
			l += 1
		maxl = max(l, maxl)
	print(maxl + 1)
t = int(input())
stringarr = [None for i in range(t)]
for i in range(t):
	stringarr[i] = input()
for i in range(t):
	length(stringarr[i])


n = int(input())
l = []
for i in range(n):
	ch = input('')
	l.append(ch)
for ch in l:
	c = []
	n = len(ch)
	if n == 1:
		if ch[0] == 'R':
			print(1)
		else:
			print(2)
	else:
		i = 0
		while i < n - 1:
			j = i
			while j < n - 1 and ch[j] == 'L':
				if ch[j] == ch[j + 1]:
					j = j + 1
				else:
					break
			if j == i:
				i = i + 1
			else:
				c.append(j - i + 1)
				i = j
		if c != []:
			print(max(c) + 1)
		elif 'L' not in ch:
			print(1)
		else:
			if ch[0] == 'R':
				print(2)
			if ch[0] == 'L':
				print(2)


testcases = int(input())
for i in range(testcases):
	directions = list(input())
	arr = [-1]
	if 'R' not in directions:
		print(len(directions) + 1)
	else:
		for i in range(len(directions)):
			if directions[i] == 'R':
				arr.append(i)
		arr.append(len(directions))
		d = 0
		for i in range(len(arr) - 1):
			if abs(arr[i] - arr[i + 1]) > d:
				d = abs(arr[i] - arr[i + 1])
		print(d)


for _ in range(int(input())):
	s = input()
	prev = -1
	d = 0
	n = len(s)
	for i in range(n):
		if s[i] == 'R':
			d = max(d, i - prev)
			prev = i
	if d == 0:
		print(n + 1)
	else:
		d = max(d, n - prev)
		print(d)


for i in range(int(input())):
	print(1 + max(map(len, input().split('R'))))


def helper(s):
	if 'R' not in s:
		return len(s) + 1
	minl = 1
	counter = 1
	s = 'R' + s
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'L':
			counter += 1
		else:
			if minl < counter:
				minl = counter
			counter = 1
	return minl
T = int(input())
for i in range(T):
	s = input()
	print(helper(s))


t = int(input())
for y in range(t):
	s = input()
	ct = 0
	ans = 0
	for i in s:
		if i == 'L':
			ct += 1
		else:
			ans = max(ans, ct)
			ct = 0
	print(max(ans, ct) + 1)


inps = int(input())
res = []
count = 0
counts = []
for i in range(inps):
	x = input()
	for i in x:
		if i == 'L':
			count += 1
		else:
			counts.append(count)
			count = 0
	if 'R' not in x:
		counts.append(count)
		count = 0
	if x[-1] == 'L':
		if count > sorted(counts)[-1]:
			counts.append(count)
		count = 0
	ans_arr = sorted(counts)
	ans = ans_arr[-1] + 1
	res.append(ans)
	counts = []
for i in res:
	print(i)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = list(input().rstrip())
	(c, m) = (0, 0)
	for i in s:
		if i == 'L':
			c += 1
		else:
			c = 0
		m = max(m, c)
	ans = m + 1
	print(ans)


for _ in range(int(input())):
	str = input()
	count = 0
	leng = len(str)
	if str.count('R') == leng:
		print(1)
		continue
	if str.count('L') == leng:
		print(leng + 1)
		continue
	i = 0
	maxcount = 0
	while i < leng:
		count = 0
		while i < leng and str[i] == 'L':
			count += 1
			i += 1
			if maxcount < count:
				maxcount = count
		i += 1
	print(maxcount + 1)


test_cases = int(input())
test = test_cases
data = []
while test_cases > 0:
	data.append(input())
	test_cases -= 1
for i in range(0, test):
	dummy = [0]
	for j in range(0, len(data[i])):
		if data[i][j] == 'R':
			dummy.append(j + 1)
	dummy.append(len(data[i]) + 1)
	ans = 0
	for k in range(0, len(dummy) - 1):
		ans = max(ans, dummy[k + 1] - dummy[k])
	print(ans)


t = int(input())
for i in range(t):
	s = input()
	num = 0
	ans = 1
	for i in s:
		num = (num + 1) * (i == 'L')
		ans = max(ans, num + 1)
	print(ans)


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	a = ['R']
	a.extend(list(inp().strip()))
	a.append('R')
	maxDist = -1
	dist = 0
	for i in a:
		if i == 'R':
			maxDist = max(maxDist, dist)
			dist = 0
		else:
			dist += 1
	print(maxDist + 1)


for _ in range(int(input())):
	word = input()
	n = len(word)
	if 'R' not in word:
		print(n + 1)
	else:
		temp = [0]
		for i in range(n):
			if word[i] == 'R':
				temp.append(i + 1)
		temp.append(n + 1)
		ans = []
		for i in range(len(temp) - 1):
			t = temp[i + 1] - temp[i]
			ans.append(t)
		ans.sort()
		print(ans[-1])


for _ in range(int(input())):
	s = input()
	a = []
	l = len(s)
	for i in range(0, l):
		if s[i] == 'R':
			a.append(i)
	if len(a) == 0:
		print(l + 1)
	elif len(a) == 1:
		print(max(a[0] + 1, l - a[0]))
	else:
		m = 0
		for i in range(0, len(a) - 1):
			if a[i + 1] - a[i] > m:
				m = a[i + 1] - a[i]
		print(max(m, a[0] + 1, l - a[-1]))


def dsw(frase):
	lista = [0]
	ans = 0
	for i in range(len(frase)):
		if frase[i] == 'R':
			lista.append(i + 1)
	lista.append(len(frase) + 1)
	for i in range(1, len(lista)):
		ans = max(ans, lista[i] - lista[i - 1])
	return ans
inp = int(input())
while inp:
	frase = str(input())
	print(dsw(frase))
	inp -= 1


for _ in range(int(input())):
	l = list(input())
	index = [i + 1 for (i, letter) in enumerate(l) if letter == 'R']
	index.insert(0, 0)
	index.append(len(l) + 1)
	ans = 0
	for i in range(len(index) - 1):
		ans = max(ans, index[i + 1] - index[i])
	print(ans)


import os
import sys
from io import BytesIO, IOBase

def chk(s, d):
	n = len(s)
	mx = d - 1
	for i in range(n):
		if i > mx:
			return False
		if s[i] == 'L':
			continue
		mx = i + d
	return mx >= n

def main():
	for _ in range(int(input())):
		s = input()
		(l, r) = (0, len(s) + 2)
		while r - l > 1:
			m = (l + r) // 2
			if chk(s, m):
				r = m
			else:
				l = m
		print(r)
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()


for i in range(int(input())):
	x = input()
	j = len(x)
	i = j - 1
	mx = 0
	while i >= 0:
		if x[i] == 'R':
			mx = max(j - i, mx)
			j = i
		i -= 1
	mx = max(j + 1, mx)
	print(mx)


k = int(input())
for w in range(k):
	jumps = input()
	minRight = 1
	count = 1
	for i in jumps:
		if i == 'R':
			if count > minRight:
				minRight = count
			count = 1
		else:
			count += 1
	if count > minRight:
		minRight = count
	print(minRight)


for _ in range(int(input())):
	s = list(input().strip())
	m = 0
	temp = -1
	for i in range(len(s)):
		if s[i] == 'R':
			m = max(m, i - temp)
			temp = i
	m = max(m, len(s) - temp)
	print(m)


b = int(input())
c = []
h = []
g = 0
for i in range(b):
	c = []
	g = 0
	a = input()
	for i in range(len(a)):
		if a[i] == 'L':
			g += 1
		else:
			c.append(g)
			g = 0
	c.append(g)
	h.append(max(c))
for i in range(b):
	print(h[i] + 1)


for _ in range(int(input())):
	string = list(input())
	string.append('R')
	count = 0
	answer = []
	for i in string:
		if i == 'R':
			count += 1
			answer.append(count)
			count = 0
		else:
			count += 1
	print(max(answer))


t = int(input())
while t:
	t -= 1
	li = list(input())
	d = 0
	i = 0
	last = 0
	j = 0
	for x in li:
		j += 1
		if x == 'L':
			i += 1
		else:
			i += 1
			last = j
			d = max(d, i)
			i = 0
	print(max(d, len(li) + 1 - last))


nn = int(input())
for i in range(nn):
	l = input()
	l += 'R'
	n = len(l) - 1
	j = -1
	cou = 1
	for i in range(n + 1):
		if l[i] == 'L':
			cou += 1
		else:
			j = max(j, cou)
			cou = 1
	j = max(j, cou)
	print(j)


from sys import stdin

def solve(s):
	ans = 0
	temp = 0
	for i in range(len(s)):
		if s[i] == 'L':
			temp += 1
		else:
			ans = max(ans, temp)
			temp = 0
	ans = max(ans, temp) + 1
	print(ans)

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		s = inp().strip()
		solve(s)
main()


def answer(s):
	count = 0
	max_count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
			if count > max_count:
				max_count = count
		else:
			count = 0
	return max_count + 1

def main():
	t = int(input())
	s = [0] * t
	for j in range(t):
		s[j] = input()
	for j in range(t):
		print(answer(s[j]))
main()


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
li = lambda : list(map(int, input().split()))

def case():
	a = input().strip()
	c = 0
	m = 0
	i = 0
	while i < len(a):
		if a[i] == 'L':
			if i == 0:
				c += 1
			elif a[i] == 'L':
				c += 1
			else:
				c += 2
			m = max(m, c)
		else:
			c = 0
		i += 1
	print(m + 1)
for _ in range(int(input())):
	case()


for _ in range(int(input())):
	s = input()
	minn = 1
	s = 'R' + s + 'R'
	re = 0
	d = True
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			if s[i] == 'L':
				re = i - 1
				d = True
			if s[i] == 'R' and d:
				d = False
				minn = max(minn, i - re)
		elif s[i] == 'R':
			re = i - 1
	print(minn)


t = int(input())
for k in range(t):
	s = input()
	ans = 0
	flag = 0
	count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		elif s[i] == 'R':
			ans = max(ans, count)
			count = 0
	ans = max(ans, count)
	print(ans + 1)


import re
T = int(input())
for t in range(T):
	string = 'R' + input() + 'R'
	max_gap = max([len(gap) for gap in string.split('R')])
	print(max_gap + 1)


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans
for __ in range(int(input())):
	s = input()
	s += 'R'
	c = 0
	x = -1
	for i in range(len(s)):
		if s[i] == 'R':
			if c < i - x:
				c = i - x
			x = i
	print(c)


def process(A):
	n = len(A)
	curr = -1
	answer = 0
	for i in range(n):
		if A[i] == 'R':
			answer = max(answer, i - curr)
			curr = i
	answer = max(answer, n - curr)
	return answer
t = int(input())
for i in range(t):
	A = input()
	print(process(A))


t = int(input())
for tt in range(t):
	s = input()
	rpos = []
	rpos.append(-1)
	for x in range(len(s)):
		if s[x] == 'R':
			rpos.append(x)
	rpos.append(len(s))
	mx = 0
	for i in range(1, len(rpos)):
		mx = max(mx, rpos[i] - rpos[i - 1])
	print(mx)


for _ in range(int(input())):
	s = 'R' + input() + 'R'
	if set(s) == 'R':
		print(1)
		continue
	else:
		l = []
		for i in range(len(s)):
			if s[i] == 'R':
				l.append(i)
		mx = l[1] - l[0]
		for i in range(2, len(l)):
			mx = max(mx, l[i] - l[i - 1])
		print(mx)


n = int(input())

def f(a):
	if not a:
		return 1
	prev = 0
	res = 1
	for (i, c) in enumerate(a, 1):
		if c == 'R':
			res = max(res, i - prev)
			prev = i
	res = max(res, len(a) + 1 - prev)
	return res
for i in range(n):
	print(f(input()))


n = int(input())

def min_dist(s):
	max_count = 0
	count = 0
	for i in s:
		if i == 'R':
			count = 0
		else:
			count += 1
			if max_count < count:
				max_count = count
	return max_count + 1
for i in range(n):
	s = input()
	print(min_dist(s))


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

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	s = 'R' + S() + 'R'
	l = len(s)
	last = -1
	maxj = -1
	for i in range(l):
		if s[i] == 'R':
			if last > -1:
				maxj = max(maxj, i - last)
			last = i
	print(maxj)


x = int(input())
for i in range(x):
	cadeiaL = 0
	flag = False
	string = str(input())
	maior = 0
	for i in range(len(string)):
		if string[i] == 'L':
			flag = True
			cadeiaL += 1
		else:
			if cadeiaL > maior:
				maior = cadeiaL
			flag = False
			cadeiaL = 0
	if cadeiaL > maior:
		maior = cadeiaL
	print(maior + 1)


t = int(input())
for te in range(t):
	a = input()
	v = []
	ans = 0
	v.append(0)
	for i in range(len(a)):
		if a[i] == 'R':
			v.append(i + 1)
	v.append(len(a) + 1)
	for i in range(len(v) - 1):
		ans = max(ans, v[i + 1] - v[i])
	print(ans)


e = ''
for i in range(int(input())):
	s = input() + 'R'
	i = 0
	(c, d) = (0, 0)
	while i < len(s):
		if s[i] == 'R':
			d = max(c, d)
			c = 0
		else:
			c += 1
		i += 1
	e += str(d + 1) + '\n'
print(e)


t = int(input())
for _ in range(t):
	s = input().strip()
	m = 0
	count = 0
	for x in s:
		if x == 'L':
			count += 1
		else:
			if count > m:
				m = count
			count = 0
	if count > m:
		m = count
	print(m + 1)


import math

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))
result = math.inf

def solve():
	s = Read.string()
	a = []
	t = 0
	for i in s:
		if i == 'R':
			a.append(t)
			t = 0
		else:
			t += 1
	a.append(t)
	print(max(a) + 1)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


for _ in range(int(input())):
	s = input()
	max_l_len = 0
	l_len = 0
	for c in s:
		if c == 'L':
			l_len += 1
		else:
			max_l_len = max(max_l_len, l_len)
			l_len = 0
	max_l_len = max(max_l_len, l_len)
	print(max_l_len + 1)


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	S = input()
	ans = 0
	cur = 0
	for s in S:
		if s == 'L':
			cur += 1
		else:
			ans = max(ans, cur)
			cur = 0
	else:
		ans = max(ans, cur)
	print(ans + 1)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

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 sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
T = int(stdin.readline())
for _ in range(T):
	s = list(stdin.readline().strip('\n'))
	l = []
	mx = -1
	for i in range(len(s)):
		if s[i] == 'L':
			l.append(s[i])
		else:
			l = []
		mx = max(len(l), mx)
	print(mx + 1)


n = int(input())
for k in range(n):
	S = 'R' + input() + 'R'
	tmp = 0
	last = 0
	for i in range(1, len(S)):
		if S[i] == 'R':
			t = i - last
			if t > tmp:
				tmp = t
			last = i
	print(tmp)


t = int(input())
a = []
for i in range(t):
	a.append(input())
for i in a:
	print(len(max(i.split('R'))) + 1)


def answer(jumpArr):
	jumpArr = 'R' + jumpArr + 'R'
	Ls = []
	Rindex = -1
	for i in range(0, len(jumpArr)):
		if jumpArr[i] == 'R':
			Ls.append(i - Rindex)
			Rindex = i
	if len(Ls) == 0:
		Ls.append(1)
	return max(Ls)
testCount = int(input())
testCases = []
for _ in range(0, testCount):
	testCases.append(str(input()))
for i in range(0, len(testCases)):
	print(answer(testCases[i]))


n = int(input())
ans = []
for i in range(n):
	s = 'R' + input() + 'R'
	R = []
	last_R = 0
	maxx = -1
	L = []
	for i in range(1, len(s)):
		if s[i] == 'R':
			R.append(i)
			if i - last_R > maxx:
				maxx = i - last_R
			last_R = i
		else:
			L.append(i)
	if maxx == -1:
		maxx = len(s)
	ans.append(maxx)
print(*ans, sep='\n')


n = int(input())
t = 0
while t < n:
	array = []
	string = input()
	for i in string:
		array.append(i)
	add = 0
	mini = 0
	for i in array:
		if i == 'L':
			add += 1
		else:
			mini = max(mini, add)
			add = 0
	mini = max(mini, add)
	print(mini + 1)
	t += 1


for _ in range(int(input())):
	a = input()
	a = 'R' + a + 'R'
	ss = 0
	j = -1
	for i in range(len(a)):
		if a[i] == 'R':
			ss = max(ss, i - j)
			j = i
	print(ss)


for _ in range(int(input())):
	string = input().strip()
	n = len(string)
	ans = -1
	prev = n
	for i in range(n - 1, -2, -1):
		if i == -1:
			ans = max(prev - -1, ans)
			continue
		if string[i] == 'R':
			ans = max(prev - i, ans)
			prev = i
	if ans == -1:
		ans = n + 1
	print(ans)


for j in range(int(input())):
	w = 0
	z = input()
	a = []
	b = 1
	for j in z:
		if j == 'L':
			b += 1
		else:
			if b:
				a.append(b)
			b = 1
	if b:
		a.append(b)
	print(max(a))


for _ in [0] * int(input()):
	s = input()
	(otvet, last_R) = (0, -1)
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			otvet = len(s) - i
			last_R = i
			break
	if last_R == -1:
		otvet = len(s) + 1
	new_max = 2 if s[0] == 'L' else 1
	newotvet = new_max
	for i in range(1, len(s)):
		if s[i] == 'L':
			new_max += 1
			newotvet = max(newotvet, new_max)
		else:
			new_max = 1
	print(max(newotvet, otvet))


from math import ceil
for _ in range(int(input())):
	s = input()
	n = len(s)
	l = s.count('L')
	r = s.count('R')
	if r == 0:
		print(n + 1)
	elif l == 0:
		print(1)
	else:
		b = [0]
		for i in range(len(s)):
			if s[i] == 'R':
				b.append(i + 1)
		b.append(len(s) + 1)
		k = []
		for i in range(1, len(b)):
			k.append(b[i] - b[i - 1])
		print(max(k))


t = int(input())
while t > 0:
	s = input()
	left = 0
	right = 0
	mid = 0
	for i in range(len(s)):
		if s[i] == 'R':
			left = i + 1
			break
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			right = len(s) - i
			break
	prev = -1
	for i in range(len(s)):
		if s[i] == 'R':
			if prev == -1:
				prev = i
			else:
				mid = max(mid, i - prev)
				prev = i
	if left == 0:
		print(len(s) + 1)
	elif mid != 0:
		print(max(left, right, mid))
	else:
		print(max(left, right))
	t -= 1


t = int(input())
for _ in range(t):
	a = input().split('R')
	m = 0
	for i in a:
		if len(i) + 1 > m:
			m = len(i) + 1
	print(m)


def frogs(string):
	string = 'R' + string + 'R'
	res = 0
	left = 0
	for i in range(len(string)):
		if string[i] == 'R':
			res = max(res, i - left)
			left = i
	return res
for _ in range(int(input())):
	string = input()
	print(frogs(string))


t = int(input())
for _ in range(t):
	s = input()
	consec = 0
	biggest = 0
	for i in range(len(s)):
		if s[i] == 'R':
			consec = 0
		else:
			consec += 1
		if consec > biggest:
			biggest = consec
	print(biggest + 1)


for _ in range(int(input())):
	x = input()
	c = 0
	m = 0
	for i in x:
		if i == 'L':
			c += 1
		else:
			if c > m:
				m = c
			c = 0
	if c > m:
		m = c
	print(m + 1)


t = int(input())
all_res = []
for _ in range(t):
	s = input()
	n = len(s)
	diff = [0] + [i + 1 for i in range(n) if s[i] == 'R'] + [n + 1]
	res = max([diff[i + 1] - diff[i] for i in range(len(diff) - 1)])
	all_res.append(str(res))
print('\n'.join(all_res))


import sys
T = int(input())
t = 0
while t < T:
	L = input()
	conta = 0
	out = 0
	for c in L:
		if c == 'R':
			if conta > out:
				out = conta
			conta = 0
		else:
			conta += 1
	if conta > out:
		out = conta
	print(out + 1)
	t += 1


t = int(input())
for i in range(t):
	string = input()
	resp = 0
	lista = [0]
	for j in range(len(string)):
		if string[j] == 'R':
			lista.append(j + 1)
	lista.append(len(string) + 1)
	for j in range(1, len(lista)):
		aux = lista[j] - lista[j - 1]
		resp = max(resp, aux)
	print(resp)


testcases = int(input())
for testcase in range(testcases):
	getstring = str(input())
	getlen = len(getstring)
	dicts = {}
	getRindex = []
	index = 0
	for i in getstring:
		index += 1
		if i == 'R':
			getRindex.append(index)
	if len(getRindex) == 0:
		print(getlen + 1)
		continue
	getRindex.insert(0, 0)
	getRindex.append(getlen + 1)
	maxdiff = 0
	getrarrlen = len(getRindex)
	for i in range(1, getrarrlen):
		maxdiff = max(maxdiff, getRindex[i] - getRindex[i - 1])
	print(maxdiff)


def ok(x):
	i = -1
	while i < n:
		if i + x >= n:
			return True
		b = False
		for j in range(1, x + 1):
			if s[i + j] == 'R':
				i += j
				b = True
				break
		if b == False:
			return False
t = int(input())
while t > 0:
	s = list(input())
	n = len(s)
	lb = 1
	rb = n + 1
	while lb < rb:
		mb = (lb + rb) // 2
		if ok(mb):
			rb = mb
		else:
			lb = mb + 1
	print(lb)
	t -= 1


for i in range(int(input())):
	data = 'R' + input() + 'R'
	maxDist = 1
	last = 0
	for i in range(1, len(data)):
		if data[i] == 'R':
			maxDist = max(maxDist, i - last)
			last = i
	print(maxDist)


t = int(input())
for i in range(0, t):
	st = input()
	st = 'R' + st + 'R'
	dist = 0
	ref = 0
	for i in range(1, len(st)):
		if st[i] == 'R':
			if i - ref >= dist:
				dist = i - ref
			ref = i
	print(dist)


t = int(input())
for _ in range(t):
	s = input()
	if s.count('R') == 0:
		print(len(s) + 1)
	elif s.count('L') == 0:
		print(1)
	else:
		d = 1
		internal = 1
		for cell in s:
			if cell == 'R':
				internal = 1
			else:
				internal += 1
			d = max(internal, d)
		print(d)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		string = input()
		n = len(string)
		maxdis = 0
		prevR = 0
		for i in range(n):
			if string[i] == 'R':
				currdis = i + 1 - prevR
				maxdis = max(maxdis, currdis)
				prevR = i + 1
			elif i == n - 1:
				currdis = n + 1 - prevR
				maxdis = max(maxdis, currdis)
		yield maxdis
t = int(input())
ans = gift()
print(*ans, sep='\n')


for t in range(int(input())):
	s = input()
	ans = 0
	count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		else:
			count = 0
		if count > ans:
			ans = count
	print(ans + 1)


N = int(input())
for t in range(N):
	s = input()
	A = s.split('R')
	ans = 0
	for s in A:
		ans = max(ans, len(s))
	print(ans + 1)


t = int(input())
while t > 0:
	seq = input()
	c = 0
	d = 0
	for val in seq:
		if val == 'L':
			c += 1
		else:
			d = max(c, d)
			c = 0
	d = max(c, d)
	d += 1
	print(d)
	t -= 1


import sys
read = lambda : list(map(int, sys.stdin.readline().strip().split()))
for _ in range(int(input())):
	s = input()
	pos = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			pos.append(i + 1)
	pos.append(len(s) + 1)
	d = 1
	for i in range(len(pos) - 1):
		d = max(d, pos[i + 1] - pos[i])
	print(d)


n = int(input())
for i in range(n):
	s = input()
	last_r_idx = -1
	maxi = float('-inf')
	for i in range(len(s)):
		if s[i] == 'R':
			maxi = max(maxi, i - last_r_idx)
			last_r_idx = i
	maxi = max(maxi, len(s) - last_r_idx)
	print(maxi)


t = int(input())
for i in range(t):
	s = input()
	mx = 0
	x = 1
	for ch in s:
		if ch == 'L':
			x += 1
		else:
			mx = max(mx, x)
			x = 1
	mx = max(mx, x)
	print(mx)


t = int(input())
for i in range(t):
	a = input()
	k = 0
	m = 0
	n = len(a)
	for i in range(n):
		if a[i] == 'R':
			if i + 1 - k > m:
				m = i - k + 1
			k = i + 1
	if n + 1 - k > m:
		m = n + 1 - k
	print(m)


for _ in range(int(input())):
	s = str(input())
	(ans, temp) = (0, 1)
	for i in range(1, len(s)):
		if s[i] == s[i - 1] == 'L':
			temp += 1
		else:
			ans = max(ans, temp)
			temp = 1
	ans = max(ans, temp)

	def allCharactersSame(s):
		n = len(s)
		for i in range(1, n):
			if s[i] != s[0]:
				return False
		return True
	if allCharactersSame(s) and s[0] == 'R':
		print(1)
	else:
		print(ans + 1)


n = int(input())
for i in range(n):
	s = input()
	cnt = 0
	ans = 0
	flag1 = 0
	for j in range(len(s)):
		if flag1:
			if s[j] == 'L':
				cnt += 1
			else:
				ans = max(ans, cnt + 1)
				flag1 = 0
				cnt = 0
		elif s[j] == 'L':
			cnt += 1
			flag1 = 1
		else:
			cnt = 0
	ans = max(ans, cnt + 1)
	print(ans)


t = int(input())
for i in range(t):
	s = input() + 'R'
	mx = -float('inf')
	cur = 0
	while s.find('R', cur) != -1:
		nxt = s.find('R', cur)
		d = nxt - cur
		if d > mx:
			mx = d
		cur = nxt + 1
	print(mx + 1)


def check(d):
	global a, s
	prev = 0
	i = 0
	while prev != len(s) + 1:
		while i < len(a) and a[i] - prev <= d:
			i += 1
		i -= 1
		if a[i] == prev:
			return False
		prev = a[i]
	return True
for t in range(int(input())):
	s = input()
	a = [0]
	for i in range(1, len(s) + 1):
		if s[i - 1] == 'R':
			a.append(i)
	a.append(len(s) + 1)
	left = 0
	right = len(s) + 1
	while left + 1 != right:
		mid = (left + right) // 2
		if check(mid):
			right = mid
		else:
			left = mid
	print(right)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	t = II()
	for _ in range(t):
		s = SI()
		ans = 1
		w = 0
		for c in s:
			if c == 'L':
				w += 1
			else:
				ans = max(ans, w + 1)
				w = 0
		ans = max(ans, w + 1)
		print(ans)
main()


for i in range(int(input())):
	a = input()
	a += 'R'
	r = -1
	l = []
	for j in range(0, len(a)):
		if a[j] == 'R':
			l.append(j - r)
			r = j
	print(max(l))


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	a = input()
	n = len(a)
	c = 0
	ans = []
	for i in range(n):
		if a[i] == 'R':
			ans.append(c + 1)
			c = 0
		else:
			c += 1
	ans.append(c + 1)
	print(max(ans))


t = int(input())
for _ in range(t):
	s = input()
	last_idx = -1
	v = []
	for i in range(len(s)):
		if s[i] == 'R':
			c = i - last_idx
			last_idx = i
			v.append(c)
	v.append(len(s) - last_idx)
	print(max(v))


for _ in range(int(input())):
	s = input()
	ct1 = 0
	ct2 = 0
	flag = False
	i = 0
	n = len(s)
	prev = 0
	while i < n:
		if s[i] == 'R':
			ct1 = max(ct1, i - prev)
			prev = i
		i += 1
	ct3 = 0
	ct1 = max(ct1, i - prev)
	pos = len(s) - 1
	while pos >= 0 and s[pos] == 'L':
		ct3 += 1
		pos -= 1
	pos = 0
	ct4 = 0
	while pos < n and s[pos] == 'L':
		ct4 += 1
		pos += 1
	if ct3 == ct1 or ct1 == ct4:
		ct1 += 1
	print(ct1)


def solve(a):
	a = 'R' + a
	n = len(a)

	def check(m):
		last = n
		for i in range(n - 1, -1, -1):
			if a[i] == 'R':
				if last > i + m:
					return False
				last = i
		return True if last != n else False
	(l, r) = (1, n + 1)
	while l <= r:
		m = l + (r - l) // 2
		if check(m):
			r = m - 1
		else:
			l = m + 1
	return l
t = int(input())
for i in range(t):
	a = input()
	print(solve(a))


n = int(input())
for _ in range(n):
	s = input()
	s += 'R'
	rights = [0] + [ind + 1 for (ind, val) in enumerate(s) if val == 'R']
	ans = 0
	for x in range(1, len(rights)):
		ans = max(ans, rights[x] - rights[x - 1])
	print(ans)


n = int(input())
for i in range(n):
	s = input()
	sch = 0
	max = 0
	for sym in s:
		if sym == 'L':
			sch += 1
		else:
			if sch > max:
				max = sch
			sch = 0
	if sch > max:
		max = sch
	print(max + 1)


test_cases = int(input())
strings = []
for i in range(test_cases):
	s = input()
	strings.append(s)
for string in strings:
	if 'R' not in string.upper():
		d = len(string) + 1
		print(d)
	elif 'L' not in string.upper():
		d = 1
		print(d)
	else:
		str_list = string.split('R')
		str_list.sort(reverse=True)
		d = len(str_list[0]) + 1
		print(d)


t = int(input())
for p in range(t):
	s = input()
	maxi = 0
	x = 0
	for item in s:
		if item == 'L':
			x += 1
			if x > maxi:
				maxi = x
		else:
			x = 0
	print(maxi + 1)


import sys
import heapq
from math import ceil, floor, gcd, fabs, factorial, fmod
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
mod = pow(10, 9) + 7
mod2 = 998244353

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

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

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

def sl():
	return list(map(str, data().split()))

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 [[val for i in range(n)] for j in range(m)]
for _ in range(int(data())):
	s = data()
	answer = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			answer.append(i + 1)
	answer.append(len(s) + 1)
	res = 1
	for i in range(len(answer) - 1):
		res = max(res, answer[i + 1] - answer[i])
	out(str(res) + '\n')


for ii in range(int(input())):
	a = input()
	l = []
	n = len(a)
	ans = n + 1
	for i in range(0, n):
		if a[i] == 'R':
			l.append(i + 1)
	l.append(n + 1)
	if len(l) == 1:
		print(ans)
	else:
		temp = l[0]
		pos = l[0]
		for i in range(1, len(l)):
			if l[i] - pos <= temp:
				pass
			else:
				temp = l[i] - pos
			pos = l[i]
		print(temp)


from sys import stdin
input = stdin.readline
q = int(input())
for rwewer in range(q):
	s = input()
	n = len(s)
	naj_seg = 1
	odp = 1
	count = 0
	for i in range(n):
		if s[i] == 'L':
			count += 1
		else:
			naj_seg = max(naj_seg, count + 1)
			count = 0
	naj_seg = max(naj_seg, count + 1)
	print(naj_seg)


t = int(input())
for _ in range(t):
	s = str(input())
	s = 'R' + s
	s = list(s)
	s.reverse()
	temp = -1
	ds = []
	for i in range(len(s)):
		if s[i] == 'R':
			ds.append(i - temp)
			temp = i
	print(max(ds))


inf = float('inf')
for _ in range(int(input())):
	a = -inf
	last = 0
	for (i, x) in enumerate(input(), 1):
		if x == 'R':
			a = max(a, i - last)
			last = i
	print(max(a, i + 1 - last))


test_cases = int(input())
for i in range(test_cases):
	board = list(map(len, input().split('R')))
	print(max(board) + 1)


for i in range(int(input())):
	avl = input()
	li = [0]
	n = len(avl)
	for j in range(n):
		if avl[j] == 'R':
			li.append(j + 1)
	li.append(n + 1)
	nn = len(li)
	ans = 0
	for j in range(nn - 1):
		ans = max(li[j + 1] - li[j], ans)
	print(ans)


T = int(input())
for t in range(T):
	s = input()
	s += 'R'
	c = 1
	ans = 0
	for i in s:
		if i == 'R':
			ans = max(ans, c)
			c = 1
		else:
			c += 1
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	l = 0
	r = 1
	B = list()
	B.append(0)
	for i in range(0, len(s)):
		if s[i] == 'L':
			l += 1
		else:
			r += 1
			B.append(i + 1)
	B.append(len(s) + 1)
	c = 0
	for i in range(0, len(B) - 1):
		c = max(c, B[i + 1] - B[i])
	print(c)


t = int(input())
while t > 0:
	(string, ans, id) = (input(), 1, 0)
	string = 'R' + string + 'R'
	while id < len(string):
		if string[id] == 'L':
			count = 1
			while string[id] != 'R':
				count += 1
				id += 1
			ans = max(ans, count)
		id += 1
	print(ans)
	t -= 1


for _ in range(int(input())):
	s = input()
	s = 'R' + s + 'R'
	m = 1
	i = 0
	for j in range(1, len(s)):
		if s[j] == 'R':
			m = max(m, j - i)
			i = j
	print(m)


t = int(input())
for _ in range(t):
	s = input().split('R')
	s = list(map(len, s))
	print(max(s) + 1)


t = int(input())
for i in range(t):
	n = input()
	sp = []
	x = len(n)
	for i in range(x):
		if n[i] == 'R':
			sp.append(i)
	if len(sp) == 0:
		print(x + 1)
		continue
	d = sp[0] + 1
	x = len(sp)
	for i in range(x - 1):
		d = max(d, sp[i + 1] - sp[i])
	d = max(d, len(n) - sp[-1])
	print(d)


for _ in range(int(input())):
	s = input()
	a = [0] + [i + 1 for i in range(len(s)) if s[i] == 'R'] + [len(s) + 1]
	answer = 0
	for i in range(1, len(a)):
		answer = max(answer, a[i] - a[i - 1])
	print(answer)


t = int(input())
for _ in range(t):
	str_ = input()
	r_arr = []
	for (idx, i) in enumerate(str_):
		if i == 'R':
			r_arr.append(idx + 1)
	r_arr.append(len(str_) + 1)
	r_arr.insert(0, 0)
	max = 0
	for (idx, i) in enumerate(r_arr[1:]):
		if max < i - r_arr[idx]:
			max = i - r_arr[idx]
	print(max)


t = int(input())
for _ in range(t):
	(l, temp) = (0, 0)
	for c in input():
		if c == 'R':
			l = max(l, temp)
			temp = 0
		else:
			temp += 1
	l = max(l, temp)
	print(l + 1)


try:

	def fun(n, l):
		L = list(set(l))
		if len(L) == 1:
			if L[0] == 'L':
				return n + 1
			else:
				return 1
		l.append(0)
		c = 1
		L = []
		for i in l:
			if i == 'L':
				c += 1
			else:
				L.append(c)
				c = 1
		return max(L)
	t = int(input())
	for _ in range(t):
		l = input()
		l = list(l)
		n = len(l)
		ans = fun(n, l)
		print(ans)
except:
	pass


import sys, math
input = sys.stdin.readline

def inp():
	return int(input())

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

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

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	a = insr()
	a = 'R' + a + 'R'
	w = 0
	q = 1
	for i in range(1, len(a)):
		if a[i] == 'R':
			if i - w >= q:
				q = i - w
			w = i
	print(q)


t = int(input())
for _ in range(t):
	move = list(input())
	cnt = 0
	jump = 0
	for i in range(len(move)):
		if move[i] == 'R':
			jump = max(cnt, jump)
			cnt = 0
		else:
			cnt += 1
	print(max(cnt, jump) + 1)


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		ss = input()
		res = 1
		jump = 1
		for s in ss:
			if s == 'L':
				jump += 1
			else:
				jump = 1
			res = max(jump, res)
		print(res)
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in range(int(input())):
	s = input()
	l = -1
	d = []
	for i in range(len(s)):
		if s[i] == 'R':
			d.append(i - l)
			l = i
	d.append(len(s) - l)
	print(max(d))


def c(string):
	d = 0
	last_r = -1
	for (i, s) in enumerate(string):
		if s == 'R':
			d = max(d, i - last_r)
			last_r = i
	print(max(d, i - last_r + 1))
tests = int(input())
while tests:
	jumps = input()
	c(jumps)
	tests -= 1


for _ in range(int(input())):
	s = input()
	ans = 0
	cur = 0
	for i in range(len(s)):
		if s[i] == 'L':
			cur += 1
		else:
			ans = max(ans, cur)
			cur = 0
	ans = max(ans, cur)
	print(ans + 1)


t = int(input())
for w in range(t):
	l = input().split('R')
	print(len(max(l)) + 1)


x = 1
x += 2
x = 1
y = 0
y += 1
y = 1
for _____ in range(1):
	for tin in range(int(input())):
		s = str(input())
		if 'R' not in s:
			print(len(s) + 1)
		elif 'L' not in s:
			print('1')
		else:
			a = []
			for _ in range(len(s)):
				if s[_] == 'R':
					a.append(_)
			b = []
			for _ in range(len(a) - 1):
				b.append(a[_ + 1] - a[_])
			if len(b) > 0:
				print(max(max(b), max(a[0], len(s) - a[len(a) - 1] - 1) + 1))
			else:
				print(max(a[0], len(s) - a[len(a) - 1] - 1) + 1)


t = int(input())
for i in range(t):
	s = input()
	s = 'R' + s + 'R'
	ans = 0
	seq = False
	x = 0
	j = 0
	while j < len(s):
		if s[j] == 'L':
			if seq == True:
				x += 1
			else:
				seq = True
				x = 1
		elif seq == True:
			if ans < x:
				ans = x
			seq = False
			x = 0
		j += 1
	print(ans + 1)


from math import ceil
from collections import deque
for _ in range(int(input())):
	s = input()
	c = 0
	mx = 0
	for i in s:
		if i == 'L':
			c += 1
			mx = max(mx, c)
		else:
			c = 0
	print(mx + 1)


for _ in range(0, int(input())):
	s = input()
	ans = 0
	cnt = 0
	for i in range(0, len(s)):
		if s[i] == 'L':
			cnt += 1
		else:
			if cnt > ans:
				ans = cnt
			cnt = 0
	if cnt > ans:
		ans = cnt
	print(ans + 1)


for i in range(int(input())):
	x = input().split('R')
	long = list(map(len, x))
	print(max(long) + 1)


for item in [0] * int(input()):
	s = input()
	count = 0
	length = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
			length = max(length, count)
		else:
			count = 0
	print(length + 1)


t = int(input())

def solve(s):
	(mx, cur) = (-1, 0)
	for c in s:
		if c == 'L':
			cur -= 1
		else:
			mx = max(mx, -cur)
			cur = 0
	return max(mx, -cur) + 1
for _ in range(t):
	s = input()
	print(solve(s))


for _ in range(int(input())):
	s = list(input())
	pos = [0]
	pos.extend([x + 1 for x in range(len(s)) if s[x] == 'R'])
	pos.append(len(s) + 1)
	ans = 0
	for x in range(len(pos) - 1):
		ans = max(ans, pos[x + 1] - pos[x])
	print(ans)


for _ in range(int(input())):
	l = str(input())
	b = list()
	try:
		k = l.index('R')
		for i in range(l.index('R') + 1, len(l)):
			if l[i] == 'R':
				b.append(i - k)
				k = i
		b.append(l.index('R') + 1)
		for j in range(len(l)):
			if l[len(l) - 1 - j] == 'R':
				b.append(j + 1)
				break
		print(max(b))
	except:
		print(len(l) + 1)


t = int(input())
for i in range(t):
	l = list(input())
	l.insert(0, 'R')
	l.append('R')
	ind = []
	for j in range(len(l)):
		if l[j] == 'R':
			ind.append(j)
	MAX = 0
	for j in range(len(ind) - 1):
		if ind[j + 1] - ind[j] > MAX:
			MAX = ind[j + 1] - ind[j]
	print(MAX)


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

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

def li():
	return list(mi())
for _ in range(ii()):
	a = input()
	b = []
	maxx = 0
	c = 0
	for i in range(len(a)):
		if a[i] == 'L':
			c += 1
			if maxx < c:
				maxx = c
		else:
			c = 0
	print(maxx + 1)


for _ in range(int(input())):
	s = input() + 'R'
	c = 1
	mx = 1
	for i in range(len(s)):
		if s[i] == 'L':
			c += 1
		else:
			mx = max(mx, c)
			c = 1
	print(mx)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	mx = 1
	curr = 1
	for i in range(n):
		if s[i] == 'R':
			curr = 1
		else:
			curr += 1
		mx = max(mx, curr)
	print(mx)


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for tests in range(t):
	S = input().strip()
	NOW = 0
	ANS = 0
	for s in S:
		if s == 'L':
			NOW += 1
		else:
			ANS = max(ANS, NOW)
			NOW = 0
	ANS = max(ANS, NOW)
	print(ANS + 1)


for _ in range(int(input())):
	s = input()
	if s.count('R') == 0:
		print(len(s) + 1)
	elif s.count('L') == 0:
		print(1)
	else:
		c = []
		for i in range(len(s)):
			if s[i] == 'R':
				c.append(i + 1)
		d = []
		u = len(s) + 1 - max(c)
		if len(c) >= 2:
			for i in range(len(c) - 1):
				d.append(c[i + 1] - c[i])
		else:
			d.append(0)
		if u > max(d) and u > c[0]:
			print(u)
		elif max(d) >= u and max(d) >= c[0]:
			print(max(d))
		elif c[0] >= max(d) and c[0] >= u:
			print(c[0])


t = int(input())
for i in range(t):
	s = input()
	l = [0]
	for k in range(len(s)):
		if s[k] == 'R':
			l.append(k + 1)
	l.append(len(s) + 1)
	ans = 0
	for j in range(len(l) - 1):
		ans = max(ans, l[j + 1] - l[j])
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	a = []
	arr = s.split('R')
	for i in range(0, len(arr)):
		a.append(len(arr[i]))
	print(max(a) + 1)


n = int(input())
for i in range(n):
	L = [0]
	ans = 0
	l = list(map(str, input()))
	F = ['R']
	for p in l:
		F.append(p)
	F.append('R')
	for j in range(len(F)):
		if F[j] == 'R':
			L.append(j)
	for k in range(1, len(L)):
		ans = max(ans, L[k] - L[k - 1])
	print(ans)


t = int(input())
for _ in range(t):
	jumps = input()
	last_r = -1
	max_diff = float('-inf')
	for (idx, ch) in enumerate(jumps):
		if ch == 'R':
			max_diff = max(max_diff, idx - last_r)
			last_r = idx
	max_diff = max(max_diff, len(jumps) - last_r)
	print(max_diff)


for _ in range(int(input())):
	a = input()
	d = 1
	dmax = 1
	for i in a:
		if i == 'L':
			d += 1
		else:
			if dmax < d:
				dmax = d
			d = 1
	if dmax < d:
		dmax = d
	print(dmax)


t = int(input())
while t:
	t -= 1
	s = input()
	a = s.split('R')
	print(len(max(a)) + 1)


t = int(input())
for _ in range(t):
	s = input()
	(gl, ll) = (1, 1)
	for i in s:
		if i == 'L':
			ll += 1
		else:
			gl = max(ll, gl)
			ll = 1
		gl = max(ll, gl)
	print(gl)


for _ in [0] * int(input()):
	s = input() + 'R'
	r = i = 0
	while i < len(s):
		j = s.find('R', i) + 1
		r = max(r, j - i)
		i = j
	print(r)


for _ in range(int(input())):
	best = 0
	curr = 0
	for c in input():
		if c == 'R':
			curr = 0
		else:
			curr += 1
		if curr > best:
			best = curr
	print(best + 1)


T = int(input())
for t in range(T):
	s = 'R' + input() + 'R'
	l = len(s)
	res = 0
	prev = 0
	for i in range(1, l):
		c = s[i]
		if c == 'R':
			if i - prev > res:
				res = i - prev
			prev = i
	print(res)


for _ in range(int(input())):
	s = input()
	ind = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			ind.append(i + 1)
	ind.append(len(s) + 1)
	mx = 0
	for i in range(len(ind) - 1):
		mx = max(mx, ind[i + 1] - ind[i])
	print(mx)


for _ in range(int(input())):
	st = str(input())
	li = max(map(len, st.split('R')))
	print(li + 1)


t = int(input())
for i in range(t):
	s = input()
	s = 'R' + s + 'R'
	ans = -1
	last = 0
	for j in range(len(s)):
		if s[j] == 'R':
			ans = max(ans, j - last)
			last = j
	print(ans)


t = int(input())
for q in range(t):
	s = input()
	l = 0
	m = 0
	for i in s:
		if i == 'L':
			l += 1
		else:
			m = max(l, m)
			l = 0
	m = max(l, m)
	print(m + 1)


t = int(input())
for i in range(t):
	a = input()
	b = [0]
	c = []
	for j in range(len(a)):
		if a[j] == 'R':
			b.append(j + 1)
	b.append(len(a) + 1)
	for k in range(len(b) - 1):
		c.append(b[k + 1] - b[k])
	print(max(c))


for _ in range(int(input())):
	s = input()
	s = '#' + s + 'R'
	pos = 0
	ans = []
	for i in range(len(s)):
		if s[i] == 'R':
			ans.append(i - pos)
			pos = i
	print(max(ans))


import os
import sys
from io import BytesIO, IOBase

def solution(s):
	n = len(s)
	r_indices = [i + 1 for i in range(n) if s[i] == 'R']
	r_indices.append(n + 1)
	r_indices.insert(0, 0)
	res = max((r_indices[i + 1] - r_indices[i] for i in range(len(r_indices) - 1)))
	write(res)

def main():
	for _ in range(r_int()):
		s = input()
		solution(s)
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')

def write(x='', end='\n'):
	sys.stdout.write(str(x) + end)

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

def r_int():
	return int(input())

def p_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


from math import *
import heapq
T = int(input())
for _ in range(T):
	arr = input()
	j = 0
	Arr = []
	Arr.append(0)
	while arr.find('R', j) != -1:
		j = arr.find('R', j) + 1
		Arr.append(j)
	Arr.append(len(arr) + 1)
	Max = 0
	for i in range(1, len(Arr)):
		Max = max(Max, Arr[i] - Arr[i - 1])
	print(Max)


t = int(input())
for _ in range(t):
	s = list(input())
	count = 0
	mx = 0
	for c in s:
		if c == 'L':
			count += 1
		else:
			if count > mx:
				mx = count
			count = 0
	if count > mx:
		mx = count
	print(mx + 1)


numTests = int(input())
for _ in range(numTests):
	cols = input()
	longest = 0
	count = 0
	for ii in range(len(cols)):
		if cols[ii] == 'L':
			count += 1
			if count > longest:
				longest = count
		else:
			count = 0
	print(longest + 1)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

def solve(s):
	t = 0
	count = 0
	for j in range(len(s)):
		if s[j] == 'L':
			t += 1
		elif s[j] == 'R':
			count = max(count, t)
			t = 0
	if j == len(s) - 1:
		count = max(count, t)
	print(count + 1)
t = inp()
for _ in range(t):
	jumps = insr()
	solve(jumps)


for _ in range(int(input())):
	X = input()
	Max = 0
	Count = 0
	for i in X:
		if i == 'L':
			Count += 1
			Max = max(Max, Count)
		else:
			Count = 0
	print(Max + 1)


t = int(input())
for _ in range(t):
	st = input()
	max_d = 0
	last_r = -1
	for (i, s) in enumerate(st):
		if s == 'R':
			max_d = max(max_d, i - last_r)
			last_r = i
	max_d = max(max_d, len(st) - last_r)
	print(max_d)


t = int(input())
for i in range(t):
	str_ = [i for i in input()]
	str_.append('R')
	maxa = [0]
	for j in range(len(str_)):
		if str_[j] == 'R':
			maxa.append(j + 1)
	precalc = []
	for j in range(1, len(maxa)):
		precalc.append(maxa[j] - maxa[j - 1])
	print(max(precalc))


def solve(path):
	path = 'R' + path
	indexes_of_R = [i for i in range(len(path)) if path[i] is 'R'] + [len(path)]
	apart = [indexes_of_R[j + 1] - indexes_of_R[j] for j in range(len(indexes_of_R) - 1)]
	return max(apart)
t = int(input())
for i in range(t):
	path = input()
	y = solve(path)
	print(y)


import sys
input = sys.stdin.readline

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 998244353
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(t,) = I()
while t:
	t -= 1
	s = input() + 'R'
	prev = -1
	n = len(s)
	ans = -1
	(first, last) = (-1, -1)
	for i in range(n):
		if s[i] == 'R':
			ans = max(ans, i - prev)
			prev = i
	if ans == -1:
		ans = n
	print(ans)


for _ in range(int(input())):
	s = input()
	(got, c, m) = (False, 1, 0)
	for (i, el) in enumerate(s):
		if el == 'R' and (not got):
			got = True
			m = c
			c = 1
		elif el == 'L':
			c += 1
		elif el == 'R' and got:
			m = max(c, m)
			c = 1
	print(max(c, m))


import math
import bisect
from itertools import groupby

def rints():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	s = input()
	ans = 1
	for (key, g) in groupby(s):
		if key == 'L':
			ans = max(ans, len(list(g)) + 1)
	print(ans)


for _ in range(int(input())):
	l = list(input())
	ans = []
	n = len(l)
	ans.append(0)
	for i in range(n):
		if l[i] == 'R':
			ans.append(i + 1)
	ans.append(n + 1)
	if len(ans) == 2:
		print(n + 1)
		continue
	res = 0
	for i in range(len(ans) - 1):
		res = max(res, ans[i + 1] - ans[i])
	print(res)


t = int(input())
for _ in range(t):
	string = list(map(str, input()))
	R_count = string.count('R')
	L_count = string.count('L')
	index = -3
	if R_count == len(string):
		print('1')
	elif L_count == len(string):
		print(L_count + 1)
	else:
		arr = []
		arr.append(0)
		for i in range(len(string)):
			if string[i] == 'R':
				arr.append(i + 1)
		arr.append(len(string) + 1)
		ans = -1
		for i in range(len(arr) - 1):
			ans = max(arr[i + 1] - arr[i], ans)
		ans = max(arr[i + 1] - arr[i], ans)
		print(ans)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	list_cell = list(sys.stdin.readline().strip())
	former = 'L'
	count = 1
	result = 0
	for cell in list_cell:
		if cell == 'R':
			count = 1
		else:
			count += 1
		result = max(result, count)
	print(result)


from sys import stdin, stdout
import math
from collections import defaultdict
t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	ans = 1
	tempans = 1
	for i in s:
		if i == 'R':
			ans = max(ans, tempans)
			tempans = 1
		else:
			tempans += 1
	print(ans)


test = int(input())
for _ in range(test):
	s = input()
	arr = [0]
	for (i, x) in enumerate(s):
		if x == 'R':
			arr.append(i + 1)
	arr.append(len(s) + 1)
	ans = 0
	for i in range(0, len(arr) - 1):
		ans = max(ans, arr[i + 1] - arr[i])
	print(ans)


for _ in range(int(input())):
	st = input()
	d = tmp = 0
	for i in range(len(st)):
		if st[i] == 'L':
			tmp += 1
		elif st[i] == 'R':
			d = max(d, tmp)
			tmp = 0
	d = max(d, tmp)
	print(d + 1)


m = int(input())
for j in range(m):
	s = str(input())
	d = 1
	newd = 1
	for i in s:
		if i == 'L':
			newd = newd + 1
		else:
			d = max(d, newd)
			newd = 1
	print(max(d, newd))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	string = stdin.readline().strip()
	lis = string.split('R')
	maxi = 0
	for i in lis:
		if maxi < len(i):
			maxi = len(i)
	maxi += 1
	stdout.write(str(maxi))
	stdout.write('\n')


res = []
for _ in range(int(input())):
	A = input()
	j = 1
	k = 0
	A = f'{A}R'
	jump = []
	for (i, s) in enumerate(A, 1):
		if s == 'R':
			jump.append(i - k)
			k = i
	res.append(max(jump))
for r in res:
	print(r)


t = int(input())
while t:
	t -= 1
	s = input()
	s = 's' + s + 'f'
	d = []
	lastR = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			d.append(i - lastR)
			lastR = i
		if s[i] == 'f':
			d.append(i - lastR)
	print(max(d))


T = int(input())
for _ in range(T):
	sl = input()
	l = list(sl)
	s = set(l)
	if len(s) == 1:
		l1 = list(s)
		if l1[0] == 'L':
			print(len(l) + 1)
		else:
			print('1')
	else:
		c = 1
		i = 0
		n = len(l)
		while i < n:
			if l[i] == 'L':
				cp = 0
				for j in range(i, n):
					if l[j] == 'L':
						cp = cp + 1
					else:
						break
				i = i + cp
				if cp > c:
					c = cp
			else:
				i = i + 1
		print(c + 1)


num = int(input())
for _ in range(num):
	s = input() + 'R'
	d = 0
	cnt = 1
	for x in s:
		if x == 'L':
			cnt += 1
		else:
			d = max([d, cnt])
			cnt = 1
	if d == 0:
		c = len(s) - 1
	print(d)


output = ''
for _ in range(int(input())):
	i = input().split('R')
	l = [len(n) for n in i]
	output += str(max(l) + 1) + '\n'
print(output)


for _ in range(int(input())):
	s = input()
	l = [0, len(s) + 1]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.sort()
	x = 0
	for i in range(len(l) - 1):
		x = max(x, l[i + 1] - l[i])
	print(x)


for tc in range(int(input())):
	s = 'R' + input() + 'R'
	c = s.count('R')
	m = -100
	ar = []
	for i in range(len(s)):
		if s[i] == 'R':
			ar.append(i)
	for i in range(len(ar) - 1):
		m = max(m, abs(ar[i] - ar[i + 1]))
	print(m)


t = int(input())
for rep in range(t):
	s = input()
	maxi = 0
	count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		else:
			if count > maxi:
				maxi = count
			count = 0
	if count > maxi:
		maxi = count
	print(maxi + 1)


for _ in range(int(input())):
	s = input()
	(count, k) = (set(), 0)
	for elem in s:
		if elem == 'L':
			k += 1
		else:
			count.add(k)
			k = 0
	count.add(k)
	print(str(max(count) + 1))


for i in range(int(input())):
	s = input()
	cur = -1
	r = -1
	for j in range(len(s)):
		if s[j] == 'R':
			if j - cur > r:
				r = j - cur
			cur = j
	if len(s) - cur > r:
		r = len(s) - cur
	print(r)


for _ in [0] * int(input()):
	stri = input()
	znach = 1
	li = []
	for i in stri:
		if i == 'L':
			znach += 1
		else:
			if znach:
				li.append(znach)
			znach = 1
	if znach:
		li.append(znach)
		print(max(li))


testCase = int(input())
for i1 in range(testCase):
	sequence = input()
	indexR = sequence.find('R') + 1
	if indexR == 0:
		indexR = len(sequence) + 1
	distance = [0]
	i2 = 0
	while i2 < len(sequence):
		if sequence[i2] == 'L':
			initial = i2
			while i2 < len(sequence) and sequence[i2] == 'L':
				i2 += 1
			final = i2
			distance.append(final - initial + 1)
		i2 += 1
	result = max(indexR, max(distance))
	print(result)


for _ in range(int(input())):
	arr = input()
	maks = 0
	temp = 1 if arr[0] == 'L' else 0
	for i in range(1, len(arr)):
		if arr[i] == 'L' and arr[i - 1] == arr[i]:
			temp += 1
		else:
			maks = max(maks, temp)
			temp = 1 if arr[i] == 'L' else 0
	maks = max(maks, temp)
	print(maks + 1)


t = int(input())
ans = []
for _ in range(t):
	s = 'R' + input() + 'R'
	last_r = 0
	max_len = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if max_len < i - last_r:
				max_len = i - last_r
			last_r = i
	ans.append(max_len)
print('\n'.join((str(i) for i in ans)))


def minD(s):
	p = -1
	m = 0
	s = s + 'R'
	for i in range(len(s)):
		if s[i] == 'R':
			if i - p > m:
				m = i - p
			p = i
	return m
t = int(input())
[print(minD(input())) for _ in range(t)]


from bisect import bisect_left, bisect_right
from typing import List
import collections
import bisect
import itertools
import functools
from fractions import gcd
import heapq
from math import ceil, sqrt, floor
import sys
sys.setrecursionlimit(50000)
import collections
from collections import defaultdict, deque
import collections
T = int(input())
for _ in range(T):
	s = 'R' + input() + 'R'
	Rs = [i for i in range(len(s)) if s[i] == 'R']
	maxv = 0
	for i in range(len(Rs) - 1):
		maxv = max(maxv, Rs[i + 1] - Rs[i])
	print(maxv)


T = int(input())
for i in range(T):
	S = str(input())
	L = -1
	stat = 0
	minI = 1000000
	Len = len(S)
	Dist = []
	for i in range(Len):
		if S[i] == 'R':
			Dist.append(i - L)
			L = i
			stat = 1
	Dist.append(Len - L)
	if stat == 0:
		print(Len + 1)
	else:
		print(max(Dist))


for _ in range(int(input())):
	ans = 0
	p = 0
	s = input()
	for i in s:
		if i == 'L':
			p += 1
		else:
			p = 0
		ans = max(ans, p)
	print(ans + 1)


for _ in range(int(input())):
	s = input() + ' '
	cnt = 1
	now = 1
	for x in s:
		if x == 'L':
			now += 1
		else:
			if now > cnt:
				cnt = now
			now = 1
	print(cnt)


for i in range(int(input())):
	s = input()
	m = s.find('R')
	if m == -1:
		print(len(s) + 1)
	else:
		l = -1
		for i in range(len(s)):
			if s[i] == 'R':
				m = max(m, i - l)
				l = i
		print(max(m, len(s) - l))


def one():
	return int(input())

def more():
	return list(map(int, input().split()))
for _ in range(one()):
	s = input() + 'R'
	cur = 0
	mx = -1
	for (ind, i) in enumerate(s):
		if i == 'R':
			d = ind + 1 - cur
			mx = max(mx, d)
			cur = ind + 1
	print(mx)


T = int(input())
for t in range(T):
	st = input()
	n = len(st)
	pos = [0]
	for i in range(n):
		if st[i] == 'R':
			pos.append(i + 1)
	pos.append(n + 1)
	ans = -1
	for i in range(1, len(pos)):
		ans = max(ans, pos[i] - pos[i - 1])
	print(ans)


casos = int(input())
for i in range(casos):
	passos = input()
	cont_R = 1
	cont_R_list = [len(passos) + 1]
	for s in passos + 'R':
		if s == 'R':
			cont_R_list.append(cont_R)
			cont_R = 1
		if s == 'L':
			cont_R += 1
	if len(cont_R_list) > 1:
		print(max(cont_R_list[1:]))
	else:
		print(cont_R_list[0])


T = int(input())
t = 0
while t < T:
	s = input()
	conta = 0
	risultato = 0
	n = 0
	N = len(s)
	while n < N:
		l = s[n]
		if l == 'L':
			conta = conta + 1
		else:
			conta = 0
		if conta > risultato:
			risultato = conta
		n = n + 1
	print(risultato + 1)
	t = t + 1


from collections import Counter
T = int(input())
for _ in range(T):
	j = 'R' + input() + 'R'
	RR = []
	for i in range(len(j)):
		if j[i] == 'R':
			RR.append(i)
	answer = 0
	for i in range(len(RR)):
		answer = max(answer, RR[i] - RR[i - 1])
	print(answer)


import math
import itertools
gh = lambda : map(int, input().split())
mod = 998244353
mod = int(mod)

def main():
	t = int(input())
	while t:
		s = '0' + input() + 'n'
		mx = 0
		i = 0
		n = len(s) - 1
		while i < n:
			j = 1
			while i + j < n and s[i + j] != 'R':
				j += 1
			mx = max(mx, j)
			i += j
		print(mx)
		t -= 1
main()


for _ in range(int(input())):
	s = list(input())
	c = 0
	m = 0
	for i in s:
		if i == 'L':
			c += 1
		else:
			m = max(m, c)
			c = 0
	if c != 0:
		m = max(m, c)
		c = 0
	print(m + 1)


def longestConsecutiveL(s):
	longest = 0
	local = 0
	for i in range(len(s)):
		if s[i] == 'L':
			local += 1
			longest = max(local, longest)
		else:
			local = 0
	return longest
for _ in range(int(input())):
	cell = input()
	ans = longestConsecutiveL(cell)
	print(ans + 1)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = ip()
for _ in range(t):
	s = ips()
	ans = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			ans.append(i + 1)
	ans.append(len(s) + 1)
	ch = -1
	for i in range(1, len(ans)):
		ch = max(ch, ans[i] - ans[i - 1])
	print(ch)


t = int(input())
for w in range(t):
	s = input()
	c = 0
	mc = 0
	for i in range(len(s)):
		if s[i] == 'L':
			c += 1
			if c > mc:
				mc = c
		else:
			c = 0
	print(mc + 1)


for _ in range(int(input())):
	s = input()
	prev = -1
	ans = 0
	fl = False
	f1 = False
	for i in range(len(s)):
		if s[i] == 'L':
			f1 = True
		if s[i] == 'R':
			fl = True
			if prev == -1:
				ans = max(ans, i + 1)
			else:
				ans = max(ans, i - prev)
			prev = i
	if prev != len(s) - 1:
		ans = max(ans, len(s) - prev)
	if not f1:
		print(1)
	elif not fl:
		print(len(s) + 1)
	else:
		print(ans)


def ans(s):
	aaa = 0
	t = 0
	for i in s:
		if i == 'L':
			t += 1
		else:
			aaa = max(aaa, t)
			t = 0
	aaa = max(aaa, t)
	return aaa + 1
for i in range(int(input())):
	s = input()
	print(ans(s))


num_t = int(input())
for _ in range(num_t):
	s = input()
	max_l = 0
	l = 0
	for e in s:
		if e == 'L':
			l += 1
		else:
			max_l = max(l, max_l)
			l = 0
	max_l = max(l, max_l)
	print(max_l + 1)


t = int(input())
for i in range(t):
	s = input()
	ind = 0
	r = 0
	maxx = -1
	for j in range(len(s)):
		if s[j] == 'R':
			r = j + 1 - ind
			maxx = max(r, maxx)
			ind = j + 1
	print(max(maxx, len(s) + 1 - ind))


t = int(input())
for i in range(t):
	s = input()
	if 'R' not in s:
		print(len(s) + 1)
	elif s.count('R') == 1:
		f = s.find('R')
		print(max(f + 1, len(s) - f))
	elif s.count('R') == len(s):
		print(1)
	else:
		j = 0
		maxx = s.find('R', j) + 1
		while j < len(s):
			k = s.find('R', j + 1)
			if k == -1:
				maxx = max(maxx, len(s) - j)
				j = len(s)
			else:
				if abs(k - j) > maxx:
					maxx = abs(k - j)
				j = k
		print(maxx)


t = int(input())
while t != 0:
	s = list(input())
	Rs = []
	m = 0
	if 'R' in s:
		for i in range(len(s)):
			if s[i] == 'R':
				Rs.append(i)
		for i in range(1, len(Rs)):
			m = max(m, Rs[i] - Rs[i - 1])
		m = max(Rs[0] + 1, m, len(s) - Rs[-1])
	else:
		m = len(s) + 1
	print(m)
	t = t - 1


t = int(input())
for _ in range(t):
	(s, t, res) = (input() + '#', 0, 1)
	for c in s:
		if c == 'L':
			t += 1
		else:
			res = max(res, t + 1)
			t = 0
	print(res)


for _ in range(int(input())):
	s = input().split('R')
	m = -1
	for i in s:
		if len(i) > m:
			m = len(i)
	print(m + 1)


n = int(input())
for i in range(n):
	s = list(input().split('R'))
	max = 0
	for i in s:
		x = len(i)
		if x > max:
			max = x
	print(max + 1)


for _ in range(int(input())):
	s = input()
	ind = []
	for i in range(len(s)):
		if s[i] == 'L':
			ind.append(i)
	if len(ind) <= 1:
		print(len(ind) + 1)
	else:
		t = 0
		Ans = []
		for i in range(1, len(ind)):
			if ind[i] - ind[i - 1] == 1:
				t += 1
			else:
				Ans.append(t)
				t = 0
		Ans.append(t)
		print(max(Ans) + 2)


for i in range(int(input())):

	def list_duplicates_of(seq, item):
		start_at = -1
		locs = []
		while True:
			try:
				loc = seq.index(item, start_at + 1)
			except ValueError:
				break
			else:
				locs.append(loc)
				start_at = loc
		return locs
	source = input()
	t = list_duplicates_of(source, 'R')
	t.insert(len(t), len(source))
	v = [t[i + 1] - t[i] for i in range(len(t) - 1)]
	v.insert(0, min(t) + 1)
	print(max(v))


t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	mx = []
	prev = 0
	for i in range(len(s)):
		if s[i] == 'R':
			mx += [i - prev]
			prev = i
	print(max(mx))


t = int(input())
for i in range(t):
	s = list(input())
	arr = []
	brr = []
	for i in range(len(s)):
		if s[i] == 'R':
			arr.append(i + 1)
	arr.insert(0, 0)
	arr.insert(len(arr), len(s) + 1)
	for i in range(len(arr) - 1):
		brr.append(arr[i + 1] - arr[i])
	print(max(brr))


for _ in range(int(input())):
	s = input()
	ans = 0
	prev = -1
	for i in range(len(s)):
		if s[i] == 'R':
			ans = max(ans, i - prev)
			prev = i
	ans = max(ans, len(s) - prev)
	if prev == -1:
		ans = len(s) + 1
	print(ans)


t = int(input())
for i in range(t):
	s = str(input())
	ans = 0
	tmp = 0
	for j in range(len(s)):
		if s[j] == 'L':
			tmp += 1
		else:
			ans = max(tmp, ans)
			tmp = 0
	print(max(ans, tmp) + 1)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	j = 0
	dif = 0
	for i in range(n):
		if s[i] == 'R':
			j = i + 1 - j
			dif = max(dif, j)
			j = i + 1
	dif = max(dif, n + 1 - j)
	print(dif)


t = int(input())
for tk in range(t):
	s = list(map(str, input().split('R')))
	mx = 0
	for i in s:
		mx = max(mx, len(i))
	print(mx + 1)


t = int(input())
for i in range(t):
	s = input()
	b = []
	for j in range(len(s)):
		if s[j] == 'R':
			b.append(j + 1)
	b.append(len(s) + 1)
	mx_d = b[0]
	for j in range(len(b) - 1):
		mx_d = max(mx_d, b[j + 1] - b[j])
	print(mx_d)


for _ in range(int(input())):
	s = input()
	ans = 0
	mini = []
	reset = 0
	for i in range(len(s)):
		if s[i] == 'L' and reset <= ans:
			ans += 1
			reset += 1
		else:
			reset = 0
			mini.append(ans)
			ans = 0
	mini.append(ans)
	print(max(mini) + 1)


for _ in range(int(input())):
	s = input().strip()
	n = len(s)
	if s.count('R') == 0:
		print(n + 1)
	elif s.count('L') == 0:
		print(1)
	else:
		prev = s.index('R')
		b = prev
		ct = prev + 1
		for i in range(b + 1, n):
			if s[i] == 'R':
				ct = max(ct, i - prev)
				prev = i
		ct = max(ct, n - prev)
		print(ct)


t = int(input())
for _ in range(t):
	s = input()
	ans = 1
	n = len(s)
	pr = -1
	for i in range(n):
		if s[i] == 'L':
			ans = max(ans, i - pr + 1)
		else:
			pr = i
	print(ans)


def main():
	t = int(input())
	for i in range(t):
		s = input()
		right = 0
		right_local = 1
		for jump in s:
			if jump == 'R':
				if right_local > right:
					right = right_local
				right_local = 1
			elif jump == 'L':
				right_local += 1
		if s[-1:] == 'L' and right_local > right:
			right = right_local
		result = right if right > 0 else len(s)
		print(result)
main()


t = int(input())
for _ in range(t):
	s = input().rstrip()
	n = len(s)
	if 'L' not in s:
		print(1)
	else:
		c = m = 1
		for i in range(n - 1):
			if s[i] == s[i + 1] and s[i] == 'L':
				c += 1
			else:
				if c > m:
					m = c
				c = 1
		if c > m:
			m = c
		print(m + 1)


import math, sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
mod1 = 1000000007
mod2 = 998244353
for _ in range(I()):
	s = S()
	s = 'R' + s + 'R'
	ans = 0
	prev = 0
	for i in range(len(s)):
		if s[i] == 'R':
			ans = max(ans, i - prev)
			prev = i
	print(ans)


t = int(input())
for _ in range(t):
	s = list(input())
	a = []
	i = 0
	a.append(0)
	while i < len(s):
		if s[i] == 'R':
			a.append(i + 1)
		i = i + 1
	a.append(i + 1)
	b = []
	i = 0
	while i < len(a) - 1:
		b.append(a[i + 1] - a[i])
		i = i + 1
	print(max(b))


def solve(s):
	maxl = 0
	c = 0
	for l in s:
		if l == 'L':
			c += 1
		else:
			c = 0
		maxl = max(maxl, c)
	return maxl + 1

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


n = int(input())
for p in range(n):
	x = input()
	l = []
	s = 1
	for i in range(len(x) - 1):
		if x[i] == 'L' and x[i + 1] == 'L':
			s += 1
		else:
			l.append(s)
			s = 1
	l.append(s)
	if x.find('L') == -1:
		print(max(l))
	else:
		print(max(l) + 1)


n = int(input())
for i in range(n):
	path = input()
	rpos = []
	for k in range(len(path)):
		if path[k] == 'R':
			rpos.append(k + 1)
	rpos.insert(0, 0)
	rpos.append(len(path) + 1)
	Max = 0
	for i in range(len(rpos) - 1):
		if rpos[i + 1] - rpos[i] > Max:
			Max = rpos[i + 1] - rpos[i]
	print(Max)


for _ in range(int(input())):
	s = input()
	i = 0
	count = 0
	max_ = 1
	while i < len(s):
		if s[i] == 'L':
			t = 'L'
			while i < len(s) and t == s[i]:
				count += 1
				i += 1
			count += 1
			if count > max_:
				max_ = count
			count = 0
		else:
			i += 1
	print(max_)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	s = sys.stdin.readline().rstrip() + 'E'
	chk = [0] * len(s)
	cnt = 1
	for i in range(len(s)):
		chk[i] = cnt
		cnt += 1
		if s[i] == 'R':
			cnt = 1
	print(max(chk))


from sys import stdin, stdout
for i1 in range(int(stdin.readline())):
	s = stdin.readline()
	s = 'R' + s
	n = len(s)
	a = []
	i = n - 1
	c = 0
	while i >= 0:
		if s[i] == 'R':
			a.append(c)
			c = 0
		i -= 1
		c += 1
	print(max(a))


R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
for _ in range(R2()):
	S = 'R' + input() + 'R'
	j = m = 0
	for i in range(len(S)):
		if S[i] == 'R':
			m = max(m, i - j)
			j = i
	print(m)


num = int(input())
max_l = 0
for i in range(num):
	st = input()
	l = 0
	for i in st:
		if i == 'L':
			l += 1
		if i == 'R':
			if max_l < l:
				max_l = l
				l = 0
			else:
				l = 0
	if max_l < l:
		max_l = l
		l = 0
	print(max_l + 1)
	max_l = 0


t = int(input())
for i in range(t):
	s = list(input())
	check = 0
	arr = []
	arr.append(0)
	l = len(s)
	for j in s:
		if j == 'L':
			check = check + 1
		else:
			arr.append(check)
			check = 0
	arr.append(check)
	print(max(arr) + 1)


t = int(input())
for test in range(t):
	a = list(input())
	res = 0
	count = 0
	for i in a:
		count += 1
		if i == 'R':
			res = max(res, count)
			count = 0
	res = max(res, count + 1)
	print(res)


def solve(s):
	(count, d) = (1, 0)
	i = 0
	while i < len(s):
		if s[i] != 'R':
			count += 1
		else:
			if count > d:
				d = count
			count = 1
		i += 1
	if count > d:
		d = count
	return d
t = int(input())
for i in range(t):
	s = input()
	print(solve(s))


for i in range(int(input())):
	s = input()
	s = s + 'R'
	s = 'R' + s
	n = len(s)
	len1 = 0
	for i in range(n - 1):
		if s[i] == 'R':
			for j in range(i + 1, n):
				if s[j] == 'R':
					if j - i > len1:
						len1 = j - i
					break
	print(len1)


def jump(s):
	letters = set(s)
	if len(letters) == 1:
		if s[0] == 'L':
			return len(s) + 1
		return 1
	maxi = 0
	d = 0
	for i in s:
		d += 1
		if i == 'R':
			if d > maxi:
				maxi = d
			d = 0
	d += 1
	if d > maxi:
		maxi = d
	return maxi
t = int(input())
for i in range(t):
	print(jump(input()))


def solve(s, size):
	back = -1
	ans = 0
	for i in range(size):
		if s[i] == 'L' and back == -1:
			back = i
		elif s[i] == 'R' and back != -1:
			ans = max(ans, i - back)
			back = -1
	if back != -1:
		ans = max(ans, size - back)
	return ans + 1
t = int(input())
for _ in range(t):
	s = input()
	size = len(s)
	print(solve(s, size))


N = int(input())
for _ in range(N):
	s = input()
	ln = 1
	now = s[0]
	ans = []
	for i in range(1, len(s)):
		if s[i] == now:
			ln += 1
		else:
			ans.append((now, ln))
			ln = 1
			now = s[i]
	ans.append((now, ln))
	mx = 0
	for (dir, ln) in ans:
		if dir == 'L':
			mx = max(mx, ln)
	print(mx + 1)


col = int(input())
for _ in range(col):
	s = input()
	l = 1
	lmax = 0
	for i in s:
		if i == 'L':
			l += 1
		else:
			l = 1
		if l > lmax:
			lmax = l
	print(lmax)


def solve(s):
	max_l_count = 0
	l_count = 0
	prev_item = s[0]
	if prev_item == 'L':
		l_count += 1
		max_l_count = 1
	for i in range(1, len(s)):
		if s[i] == 'L':
			l_count += 1
		else:
			if l_count > max_l_count:
				max_l_count = l_count
			l_count = 0
		if l_count > max_l_count:
			max_l_count = l_count
	return str(max_l_count + 1)
answers = []
t = int(input())
for i in range(t):
	s = input()
	answers.append(solve(s))
print('\n'.join(answers))


for _ in range(int(input())):
	a = input()
	n = len(a)
	i = 0
	c = 0
	while i < n:
		if a[i] == 'L':
			j = i
			temp = 1
			while j < n - 1:
				if a[j + 1] == 'L':
					temp += 1
					j += 1
				else:
					break
			if i == j:
				i += 1
				j += 1
			else:
				i = j
			c = max(c, temp)
		else:
			i += 1
	print(c + 1)


def I():
	return list(map(int, input().split()))
for __ in range(int(input())):
	s = input()
	s += 'R'
	d = 1
	i = len(s) - 1
	while i >= 0:
		final = i
		i -= 1
		while i >= 0 and s[i] != 'R':
			i -= 1
		d = max(d, final - i)
	print(d)


t = int(input())
while t > 0:
	s = input().split('R')
	print(max([len(l) for l in s]) + 1)
	t -= 1


def solve(path):
	previous = 0
	R = []
	for (i, d) in enumerate(path):
		if d == 'R':
			R.append(i - previous + 1)
			previous = i + 1
	return max(R + [len(path) - previous + 1])
[print(solve(input())) for _ in range(int(input()))]


t = int(input())
for i in range(t):
	s = input()
	jump = 0
	start = -1
	for i in range(len(s)):
		if s[i] == 'R':
			jump = max(i - start, jump)
			start = i
	jump = max(len(s) - start, jump)
	print(jump)


for _ in range(int(input())):
	arr = input()
	n = len(arr)
	d = 0
	minimun = 0
	for i in range(n):
		d += 1
		if arr[i] == 'R':
			if d > minimun:
				minimun = d
			d = 0
		if i == n - 1:
			if minimun < d + 1:
				minimun = d + 1
	print(minimun)


import sys

def findMax(x):
	n = 0
	start = 0
	while start < len(x):
		d = findFirstR(x, start)
		if d > n:
			n = d
		start = start + d
	return n

def findFirstR(x, start):
	for i in range(start, len(x)):
		if x[i] == 'R':
			return i - start + 1
	return len(x) - start + 1
lines = sys.stdin.readlines()
ntests = int(lines[0].rstrip())
for test in range(ntests):
	x = lines[test + 1].rstrip()
	print(findMax(x))


for _ in range(int(input())):
	str = 'L'
	str = str + input()
	str = str + 'R'
	m = 1
	lastPos = 0
	for i in range(1, len(str)):
		if str[i] == 'R':
			a = i - lastPos
			if a > m:
				m = a
			lastPos = i
	print(m)


n = int(input())
for _ in range(n):
	s = input()
	max_l = 0
	l = 0
	for i in range(len(s)):
		if s[i] == 'L':
			l += 1
		else:
			if max_l < l:
				max_l = l
			l = 0
	print(max(l, max_l) + 1)


def check(n):
	global s
	l = len(s)
	arr = [0] * len(s)
	for i in range(l):
		if s[i] == 'R':
			arr[i] = i + n
		else:
			arr[i] = arr[i - 1]
	ptr = n - 1
	while True:
		if ptr >= l:
			return 1
		ptr = arr[ptr]
		if ptr >= l:
			return 1
		if arr[ptr] <= ptr:
			return 0
for i in range(int(input())):
	s = input()
	l = 1
	r = len(s) + 1
	while l < r - 1:
		m = (l + r) // 2
		if check(m):
			r = m
		else:
			l = m
	if check(l):
		print(l)
	elif check(l + 1):
		print(l + 1)
	else:
		print(r)


t = int(input())
for i in range(t):
	s = input()
	ind = [-1]
	d = []
	if all((i == 'L' for i in s)):
		print(len(s) + 1)
	elif all((i == 'L' for i in s)):
		print('1')
	else:
		loc = 0
		for j in range(len(s)):
			if s[j] == 'R':
				ind.append(j)
		ind.append(len(s))
		for j in range(len(ind) - 1):
			diff = ind[j + 1] - ind[j]
			d.append(diff)
		print(max(d))


for T in range(int(input())):
	s = input()
	count = 1
	maxi = 1
	for i in s:
		if i == 'L':
			count += 1
			if count > maxi:
				maxi = count
		else:
			count = 1
	print(maxi)


for t in range(int(input())):
	s = input()
	ans = 0
	prevans = 0
	for i in range(len(s)):
		if s[i] == 'L' and i == len(s) - 1:
			ans += 1
			if ans > prevans:
				prevans = ans
		elif s[i] == 'L':
			ans += 1
		elif ans > prevans:
			prevans = ans
			ans = 0
		else:
			ans = 0
	if ans == len(s):
		print(ans + 1)
	else:
		print(prevans + 1)


for _ in range(int(input())):
	array = list(input())
	N = len(array)
	nearestR = 0
	farthestR = 0
	if len(set(array)) == 1 and array[0] == 'L':
		print(N + 1)
		continue
	for i in range(N):
		if array[i] == 'R':
			nearestR = i
			break
	Rdistance = []
	for i in range(N):
		if array[i] == 'R':
			Rdistance.append(i)
			farthestR = i
	maxdistance = -1
	for i in range(1, len(Rdistance)):
		if Rdistance[i] - Rdistance[i - 1] > maxdistance:
			maxdistance = Rdistance[i] - Rdistance[i - 1]
	print(max(nearestR + 1, N - farthestR, maxdistance))


for t in range(int(input())):
	string = input()
	ultimoR = 0
	distR = 0
	flagR = False
	for char in range(len(string)):
		if string[char] == 'R' and (not flagR):
			flagR = True
			ultimoR = char
			distR = char + 1
		elif string[char] == 'R':
			distR = max(distR, abs(char - ultimoR))
			ultimoR = char
	if not flagR:
		print(len(string) + 1)
	else:
		pulo = max(distR, abs(len(string) - ultimoR))
		print(pulo)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	arr = [0] + list(sys.stdin.readline().strip()) + [0]
	R_index = 0
	d = 0
	for i in range(len(arr)):
		if R_index == 0 and arr[i] == 'R':
			d = i
			R_index = i
		elif arr[i] == 'R':
			temp = i - R_index
			if d < temp:
				d = temp
			R_index = i
		elif i == len(arr) - 1:
			if R_index == 0:
				d = i
			else:
				temp = i - R_index
				if d < temp:
					d = temp
	print(d)


def main():
	t = 1
	t = int(input())
	for _ in range(t):
		a = input()
		a = 'R' + a
		a = a[::-1]
		lastpos = -1
		ans = 0
		for (idx, i) in enumerate(a):
			if i == 'R':
				ans = max(ans, idx - lastpos)
				lastpos = idx
		print(ans)
	return
main()


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	s = input().strip()
	dist = []
	mrk = 0
	for i in range(len(s)):
		if s[i] == 'L':
			mrk += 1
		else:
			dist.append(mrk)
			mrk = 0
	dist.append(mrk)
	if len(s) == s.count('R'):
		print(1)
	else:
		print(max(dist) + 1)


n = int(input())
for _ in range(n):
	s = input()
	s = s.split('R')
	ans = 0
	for i in s:
		ans = max(len(i), ans)
	print(ans + 1)


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

def rri():
	return int(rr())

def rrl():
	return list(map(int, rr().split()))

def rrt():
	return tuple(map(int, rr().split()))
from collections import defaultdict

def mus(d=0):
	return defaultdict(defaultdict(d))

def ms(x, y, d=0):
	return [[0] * y for i in range(x)]

def ar(x, d=0):
	return [d] * x

def ppm(m, n=0, x=0, y=0):
	print('\n'.join(('\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))

def ppa(a, n):
	print('\t'.join(map(str, a[0:n])))

def ppl(a=0, x=[1]):
	x[0] = a or x[0] + 1
	print('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')

def yn(x):
	return 'YES' if x else 'NO'
from itertools import groupby

def rnar():
	return (rri(), rrl())

def r2nar():
	return (rri(), rri(), rrl())

def read():
	return (rr(),)

def f_dp(x):
	left_side = min((max(dp[i], abs(i - x)) for i in range(0, x) if arr[i] == 'R'), default=float('inf'))
	return left_side

def solve(s):
	max_l = 0
	for (key, group) in groupby(s):
		size = len(list(group))
		if key == 'L':
			max_l = max(max_l, size)
	answ = max_l
	return answ + 1
test_count = rri()
for _ in range(test_count):
	input_data = read()
	result = solve(*input_data)
	print(result)


for _ in range(int(input())):
	i = input().split('R')
	i.sort(reverse=True)
	print(len(i[0]) + 1)


t = int(input())
for _ in range(t):
	s = input()
	count = 0
	max_count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		else:
			count = 0
		if count > max_count:
			max_count = count
	print(max_count + 1)


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	tmp = 0
	cnt = 0
	for j in range(n):
		if s[j] == 'L':
			tmp += 1
		elif s[j] == 'R':
			cnt = max(cnt, tmp)
			tmp = 0
		if j == n - 1:
			cnt = max(cnt, tmp)
	print(cnt + 1)


for t in range(int(input())):
	s = input()
	n = len(s)
	m = 0
	index = -1
	for (i, e) in enumerate(s):
		if e == 'L':
			continue
		m = max(m, i - index)
		index = i
	m = max(m, abs(n - index))
	print(m)


n = int(input())
for i in range(n):
	s = 'R' + input() + 'R'
	ind = 0
	mi = 1
	for i in range(1, len(s)):
		if s[i] == 'R':
			if i - ind > mi:
				mi = i - ind
			ind = i
	print(mi)


t = int(input())
for i in range(0, t):
	s = input()
	s = s.split('R')
	m = 0
	for j in s:
		if len(j) > m:
			m = len(j)
	print(m + 1)


t = int(input())
for _ in range(t):
	arr = [x for x in input()]
	arr = ['R'] + arr
	arr.append('R')
	brr = []
	difference = []
	for i in range(len(arr)):
		if arr[i] == 'R':
			brr.append(i)
	for i in range(len(brr) - 1):
		difference.append(brr[i + 1] - brr[i])
	if len(difference) > 0:
		print(max(difference))
	else:
		print(len(arr) - 1)


import sys
import math
import bisect

def solve(s):
	n = len(s)
	max_val = 0
	last = 0
	for i in range(1, n + 2):
		if i == n + 1 or s[i - 1] == 'R':
			val = i - last
			last = i
			max_val = max(max_val, val)
	return max_val

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


from collections import defaultdict
t = int(input())
for _ in range(t):
	d = {}
	d = defaultdict(lambda : 0, d)
	s = input()
	a = 0
	cur = 0
	k = 1
	for i in s:
		if i == 'R':
			if k - cur > a:
				a = k - cur
			cur = k
		k += 1
	if a == 0:
		print(len(s) + 1)
	else:
		if a < len(s) + 1 - cur:
			a = len(s) + 1 - cur
		print(a)


t = int(input())
for tt in range(t):
	s = input()
	d = 1
	x = 1
	for i in range(len(s)):
		if s[i] == 'R':
			x = max(d, x)
			d = 1
		else:
			d += 1
	x = max(d, x)
	print(x)


a = int(input())
for _ in range(a):
	vz = 0
	vzmax = 0
	arryLR = input()
	z = len(arryLR)
	for i in range(z):
		if arryLR[i] == 'L':
			vz += 1
		else:
			if vzmax < vz:
				vzmax = vz
			vz = 0
	if vzmax < vz:
		vzmax = vz
	print(vzmax + 1)


import sys
input = sys.stdin.readline

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

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

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

def getStr():
	return input().strip()
t = getInt()
for _ in range(t):
	s = getStr()
	s += 'R'
	res = 0
	p = -1
	for i in range(len(s)):
		if s[i] == 'R':
			res = max(res, i - p)
			p = i
	if res == 0:
		res = len(s) + 1
	print(res)


T = int(input())
for _ in range(T):
	S = 'R' + input()
	L = S.split('R')
	seq = max([len(v) for v in L])
	print(seq + 1)


def main():
	t = int(input())
	for k in range(t):
		s = input()
		positions = [0]
		for (i, jump) in enumerate(s):
			if jump == 'R':
				positions.append(i + 1)
		positions.append(len(s) + 1)
		res = -1
		for i in range(len(positions) - 1):
			res = max(res, positions[i + 1] - positions[i])
		print(res)
main()


t = int(input())
for case in range(0, t):
	s = 'R' + input() + 'R'
	m = 1
	lastR = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			m = max([m, i - lastR])
			lastR = i
	print(m)


q = int(input())
for t in range(q):
	s = input()
	maxl = 0
	curr = 0
	for i in range(s.__len__()):
		if s[i] == 'L':
			curr += 1
		else:
			if curr > maxl:
				maxl = curr
			curr = 0
	if curr > maxl:
		maxl = curr
	print(maxl + 1)


n = int(input())
for i in range(n):
	s = input()
	count = 1
	m = 0
	for j in s:
		if j == 'R':
			if count > m:
				m = count
			count = 0
		count += 1
	if count > m:
		m = count
	print(m)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
for _ in range(n):
	res = 0
	p = None
	s = is1()
	for (j, i) in enumerate(s):
		if i == 'L' and p == None:
			p = j
		if i == 'R' and p != None:
			res = max(res, j - p)
			p = None
	if p != None:
		res = max(res, j - p + 1)
	print(res + 1)


from sys import stdin
import math
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	s = str(inp())
	longL = 0
	curr = 0
	for i in range(len(s)):
		if s[i] == 'L':
			curr += 1
		longL = max(longL, curr)
		if s[i] == 'R':
			curr = 0
	print(longL + 1)


t = int(input())
for _ in range(t):
	string = 'R' + str(input()) + 'R'
	l = len(string)
	before = 0
	ret = 0
	for i in range(0, l):
		if string[i] == 'R':
			ret = max(ret, i - before)
			before = i
	print(ret)


n = int(input())
for _ in range(n):
	s = 'R' + str(input()) + 'R'
	max_c = 1
	last_r = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if i - last_r > max_c:
				max_c = i - last_r
			last_r = i
	print(max_c)


from math import inf

def main():
	a = list(input())
	arr = []
	maxx = 0
	maxxx = 0
	for i in range(len(a)):
		if a[i] == 'L':
			maxx += 1
		elif a[i] == 'R':
			maxxx = max(maxx, maxxx)
			maxx = 0
	maxxx = max(maxx, maxxx)
	print(maxxx + 1)
for _ in range(int(input())):
	main()


n = int(input())
for j in range(n):
	s = input()
	l = 0
	c = 0
	g = 0
	for i in s:
		if i == 'L':
			l += 1
			if c == len(s) - 1:
				g = max(g, l)
		else:
			if l != 0:
				g = max(g, l)
			l = 0
		c += 1
	if g == 0:
		print(1)
	else:
		print(g + 1)


import sys
import os
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')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(lst):
	n = len(lst)
	prev = 0
	maxx = 1
	n += 2
	lst = 'R' + lst + 'R'
	for i in range(n):
		if lst[i] == 'R':
			maxx = max(maxx, i - prev)
			prev = i
	return maxx
for _ in range(int(input())):
	lst = input()
	print(solve(lst))


def map_len(arr):
	total = []
	for i in range(len(arr)):
		total.append(len(arr[i]))
	return total
t = int(input())
for i in range(t):
	n = input().split('R')
	len_n = map_len(n)
	print(max(len_n) + 1)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	a = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			a.append(i + 1)
	a.append(n + 1)
	print(max([a[i] - a[i - 1] for i in range(1, len(a))]))


def ans(s):
	s = 'R' + s + 'R'
	idx = []
	for i in range(len(s)):
		if s[i] == 'R':
			idx.append(i)
	m = 0
	for i in range(len(idx) - 1):
		diff = idx[i + 1] - idx[i]
		if diff > m:
			m = diff
	print(m)
for _ in range(int(input())):
	ans(input())


t = int(input())

def frogjump(letters):
	maxn = 1
	left = -1
	for r in range(len(letters)):
		if letters[r] == 'R':
			maxn = max(maxn, r - left)
			left = r
	r += 1
	maxn = max(maxn, r - left)
	print(maxn)
for _ in range(t):
	letters = input()
	frogjump(letters)


t = int(input())
for i in range(t):
	s = input()
	flag = ''
	d = 1
	for j in s:
		if j == 'L' and flag != 'R':
			flag = 'L'
		elif j == 'R' and flag != 'L':
			flag = 'R'
		else:
			flag = ''
			break
	if flag == 'L':
		d = len(s) + 1
	elif flag == 'R':
		d = 1
	else:
		count = temp = 0
		for k in s:
			if k == 'R':
				count = max(count, temp)
				temp = 0
			else:
				temp += 1
		count = max(count, temp)
		d = count + 1
	print(d)


t = int(input())
for i in range(t):
	l = input().split('R')
	lengths = list(map(len, l))
	print(max(lengths) + 1)


test = int(input())
for _ in range(test):
	string1 = input()
	temp = [0] * (len(string1) + 2)
	dist = 0
	max1 = 0
	for i in range(0, len(string1)):
		dist += 1
		if string1[i] == 'R':
			max1 = max(dist, max1)
			dist = 0
	max1 = max(dist + 1, max1)
	print(max1)


for i in range(int(input())):
	s = input()
	global_L = 0
	local_L = 0
	for i in s:
		if i == 'R':
			global_L = max(local_L, global_L)
			local_L = 0
		else:
			local_L += 1
	if local_L != 0:
		global_L = max(global_L, local_L)
	print(global_L + 1)


t = int(input())
for ooo in range(t):
	s = input()
	n = len(s)
	e = -1
	w = -1
	for i in range(n):
		k = s[i]
		if k == 'R':
			e = max(e, i - w)
			w = i
	if w == -1:
		print(n + 1)
	else:
		e = max(n - w, e)
		print(e)


n = int(input())
for k in range(0, n):
	s = input()
	maxL = 0
	prev = ''
	cur = 0
	for x in range(0, len(s)):
		if s[x] == 'L':
			cur += 1
		else:
			cur = 0
		if cur > maxL:
			maxL = cur
	print(maxL + 1)


t = int(input())
for i in range(t):
	s = str(input())
	l = []
	x = 0
	for j in range(len(s)):
		if s[j] == 'L':
			x += 1
			continue
		if x != 0:
			l.append(x)
			x = 0
	l.append(x)
	print(max(l) + 1)


import re, math, decimal, bisect

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

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]

def round(n):
	return int(n + 0.5)
DEBUG = 1

def debug(*args, **kwargs):
	if DEBUG:
		print(*args, **kwargs)
t = iread()
for _ in range(t):
	dirs = read()
	longest = 1
	yay = False
	cur = 0
	for d in dirs + '$':
		if yay and d != 'L':
			longest = max(longest, cur + 1)
			cur = 0
		elif yay and d == 'L':
			cur += 1
		elif d == 'L':
			yay = True
			cur = 1
	print(longest)


for r in [0] * int(input()):
	print(max(map(len, input().split('R'))) + 1)


from itertools import groupby

def solve(s):
	d = 1
	for (k, v) in groupby(s):
		if k == 'L':
			l = len(list(v))
			d = max(d, l + 1)
	return d
t = int(input())
for _ in range(t):
	s = input()
	print(solve(s))


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	a = list(s)
	a = [0] + a + [1]
	n = len(s)
	ans = 0
	i = 0
	j = 0
	while j < n + 1:
		count = 1
		j += 1
		while j < n + 1 and a[j] != 'R':
			count += 1
			j += 1
		ans = max(ans, count)
		i = j
	print(ans)


t = int(input())
for q in range(t):
	s = input()
	n = len(s)
	ss = list(set(s))
	if len(ss) == 1:
		if ss[0] == 'L':
			print(n + 1)
		else:
			print(1)
		continue
	s += 'R'
	s = 'R' + s
	gap = 0
	lastr = 0
	for x in range(1, n + 2):
		if s[x] == 'R':
			if x - lastr > gap:
				gap = x - lastr
				lastr = x
			else:
				lastr = x
	print(gap)


t = int(input())
for _ in range(t):
	s = input()
	m = 1
	i = 1
	for x in s:
		if x == 'R':
			m = max(i, m)
			i = 1
		else:
			i += 1
	else:
		m = max(i, m)
	print(m)


t = int(input())
for _ in range(t):
	s = input()
	x = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			x.append(i + 1)
	x.append(len(s) + 1)
	ans = 0
	for i in range(1, len(x)):
		ans = max(ans, x[i] - x[i - 1])
	print(ans)


for _ in range(int(input())):
	a = list(input())
	c = 1
	k = 1
	for i in a:
		if i == 'L':
			k += 1
		else:
			k = 1
		c = max(k, c)
	print(c)


t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	ss = [0]
	for (i, x) in enumerate(s):
		if x == 'R':
			ss.append(i + 1)
	ss.append(n + 1)
	diff = [ss[i + 1] - ss[i] for i in range(len(ss) - 1)]
	print(max(diff))


t = int(input())
for _ in range(t):
	s = input()
	s += 'R'
	l = [-1]
	max1 = 0
	for (i, c) in enumerate(s, 0):
		if c == 'R':
			max1 = max(max1, i - l[len(l) - 1])
			l.append(i)
	print(max1)


n = int(input())
for i in range(n):
	ch = input()
	ch = 'R' + ch + 'R'
	s = 0
	l = []
	for i in range(1, len(ch) - 1):
		if ch[i] == 'L':
			s += 1
		if ch[i] == 'R':
			l.append(s)
			s = 0
	l.append(s)
	k = max(l)
	if k == 0:
		print(1)
	else:
		print(k + 1)


for _ in range(int(input())):
	s = input()
	l = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	ma = 0
	for i in range(len(l) - 1):
		if l[i + 1] - l[i] > ma:
			ma = l[i + 1] - l[i]
	print(ma)


list_ans = []
for _ in range(int(input())):
	s = input()
	list1 = [0]
	list2 = []
	for i in range(len(s)):
		if s[i] == 'R':
			list1.append(i + 1)
	list1.append(len(s) + 1)
	for i in range(len(list1) - 1):
		list2.append(list1[i + 1] - list1[i])
	list_ans.append(max(list2))
for item in list_ans:
	print(item)


t = int(input())
while t:
	s = input()
	mdiff = 0
	prev = -1
	for i in range(len(s)):
		if s[i] == 'R':
			mdiff = max(mdiff, i - prev)
			prev = i
	print(max(mdiff, len(s) - prev))
	t -= 1


for t in range(int(input())):
	s = input()
	sch = 0
	x = []
	for i in range(len(s)):
		if s[i] == 'L':
			sch += 1
		else:
			x += [sch]
			sch = 0
	x += [sch]
	k = max(x)
	print(k + 1)


for i in range(int(input())):
	s = input()
	s += 'R'
	ss = [-1]
	ans = []
	for j in range(len(s)):
		if s[j] == 'R':
			ans.append(j - ss[-1])
			ss.append(j)
	print(max(ans))


q = int(input())
for i in range(q):
	w = input()
	n = 1
	mn = 1
	for i in w:
		if i != 'R':
			mn += 1
		else:
			if mn > n:
				n = mn
			mn = 1
	if mn > n:
		n = mn
		mn = 1
	print(n)


t = int(input())
for _ in range(t):
	string = input()
	left = 0
	temp = 0
	for s in string:
		if s == 'L':
			temp += 1
			left = max(left, temp)
		else:
			temp = 0
	print(left + 1)


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
T = int(input())
for i in range(T):
	s = input()
	i = 0
	m = 0
	while i < len(s):
		cnt = 0
		while i < len(s) and s[i] == 'L':
			cnt += 1
			i += 1
		while i < len(s) and s[i] == 'R':
			i += 1
		m = max(m, cnt)
	print(str(m + 1) + '\n')


t = int(input())
for i in range(t):
	s = input()
	maiorL = 0
	aux = 'LL'
	L = 0
	for i in range(len(s)):
		if s[i] == 'L':
			L += 1
		else:
			if L > maiorL:
				maiorL = L
			L = 0
	if L > maiorL:
		maiorL = L
	print(maiorL + 1)


def solve(s):
	return max((len(ss) for ss in s.split('R'))) + 1
t = int(input())
for _ in range(t):
	s = input()
	print(solve(s))


for i in range(int(input())):
	a = input()
	s = 0
	b = []
	if set(a) == {'L'}:
		print(a.count('L') + 1)
	else:
		for i in a:
			if i == 'R':
				b.append(s)
				s = 0
			else:
				s += 1
		b.append(s)
		print(max(b) + 1)


import sys
input = sys.stdin.readline
from math import *
t = int(input())
a = []
while t > 0:
	t -= 1
	s = list(input().rstrip())
	n = len(s)
	d = []
	flag = 0
	for i in range(n):
		if s[i] == 'R':
			d.append(i + 1)
	d.insert(0, 0)
	d.append(n + 1)
	maxi = -999
	if len(d) == 2:
		print(n + 1)
		continue
	for i in range(1, len(d)):
		maxi = max(maxi, d[i] - d[i - 1])
	print(maxi)


from math import sqrt
from collections import defaultdict
t = int(input())
while t:
	t = t - 1
	a = list(input())
	ind = defaultdict(list)
	for (i, tmp) in enumerate(a):
		ind[tmp].append(i + 1)
	if 'R' not in ind:
		print(len(a) + 1)
		continue
	if 'L' not in ind:
		print(1)
		continue
	ind['R'].append(len(a) + 1)
	ind['R'].sort()
	start = 0
	ans = 0
	for i in ind['R']:
		ans = max(ans, i - start)
		start = i
	print(ans)


x = int(input())
for a in range(0, x):
	y = input()
	l = 0
	ls = 0
	for b in range(0, len(y)):
		if y[b] == 'R':
			ls = max(ls, l)
			l = 0
		else:
			l += 1
	ls = max(ls, l)
	print(ls + 1)


def ans(l):
	print(max(l) + 1)
for _ in range(int(input())):
	s = input()
	ss = s.split('R')
	l = list(map(len, ss))
	ans(l)


test_case = int(input())
while test_case:
	test_case -= 1
	string = input() + 'R'
	prev = -1
	res = 0
	for (idx, x) in enumerate(string):
		if x == 'R':
			res = max(res, idx - prev)
			prev = idx
	print(res)


t = int(input())
for _ in range(t):
	s = input()
	arr = []
	ma = -10000000
	for i in range(len(s)):
		if s[i] == 'R':
			if len(arr) != 0:
				diff = i - arr[-1]
				if diff > ma:
					ma = diff
			else:
				diff = i + 1
			if diff > ma:
				ma = diff
			arr.append(i)
	if len(arr) == 0:
		print(len(s) + 1)
	else:
		diff = len(s) - arr[-1]
		if diff > ma:
			ma = diff
		arr.append(len(s))
		print(ma)


a = int(input())
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(a):
	string = input()
	max1 = 0
	c = 0
	for j in string:
		if j == 'R':
			c = 0
		else:
			c = c + 1
			if c > max1:
				max1 = c
	print(max1 + 1)


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	s = inputstring()
	r = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(len(s) + 1)
	mx = r[1] - r[0]
	for i in range(2, len(r)):
		mx = max(r[i] - r[i - 1], mx)
	print(mx)


t = int(input())
for _ in range(t):
	s = input().strip()
	d = 1
	ans = 0
	for i in reversed(range(len(s))):
		if s[i] == 'R':
			ans = max(ans, d)
			d = 1
		else:
			d += 1
	ans = max(ans, d)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	s = input()
	n = 0
	m = -1
	for x in s:
		if x == 'L':
			n += 1
		else:
			m = max(m, n)
			n = 0
	print(m + 1)


from collections import Counter
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce

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

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	s = input()
	n = len(s)
	s = 'R' + s + 'R'
	mx = 0
	prev = 0
	for i in range(1, n + 2):
		if s[i] == 'R':
			mx = max(mx, i - prev)
			prev = i
	print(mx)


t = int(input())
while t != 0:
	n = list(input())
	i = 0
	maxi = 0
	while i < len(n):
		if n[i] == 'L':
			count = 0
			while i < len(n) and n[i] == 'L':
				count += 1
				i += 1
			if count > maxi:
				maxi = count
		else:
			i += 1
	print(maxi + 1)
	t -= 1


t = int(input())
for _ in range(0, t):
	s = input()
	max = 1
	current = 1
	for (i, j) in enumerate(s):
		if j == 'L':
			current += 1
			if current > max:
				max = current
		else:
			current = 1
	print(max)


a = int(input())
for k in range(a):
	b = input()
	t = len(b)
	if b.count('L') == t:
		print(t + 1)
	elif b.count('R') == t:
		print(1)
	else:
		max1 = 0
		f = 0
		for i in range(t):
			if b[i] == 'L':
				f += 1
			else:
				if max1 < f:
					max1 = f
				f = 0
		if max1 < f:
			max1 = f
		print(max1 + 1)


for _ in range(int(input())):
	debug = False
	path = input()
	n = len(path)
	path = 'R' + path + 'R'
	prevPos = 0
	d = float('-inf')
	for i in range(1, n + 2):
		if path[i] == 'R':
			if debug:
				print(i)
				print('\t\td before', d)
			d = max(d, i - prevPos)
			if debug:
				print('\t\td after', d)
			prevPos = i
	print(d)


n = int(input())
for i in range(n):
	cnt = 1
	max_cnt = 1
	pre_s = input()
	s = 'R' + pre_s + 'R'
	for i in s:
		if i == 'L':
			cnt += 1
			max_cnt = max(max_cnt, cnt)
		if i == 'R':
			cnt = 1
	print(max_cnt)


import collections

def solve(string):
	n = len(string)
	rPositions = [0]
	for (i, ch) in enumerate(string, 1):
		if ch == 'R':
			rPositions.append(i)
	rPositions.append(n + 1)
	d = 0
	for i in range(len(rPositions) - 1):
		d = max(d, rPositions[i + 1] - rPositions[i])
	return d
t = int(input().strip())
for i in range(t):
	string = input().strip()
	print(solve(string))


T = int(input())
for t in range(T):
	S = input()
	ans = 0
	c = 0
	for s in S:
		c += 1
		if s == 'R':
			ans = max(ans, c)
			c = 0
	c += 1
	ans = max(ans, c)
	print(ans)


for _ in range(int(input())):
	s = input()
	n = len(s)
	ans = [-1]
	for i in range(n):
		if s[i] == 'R':
			ans.append(i)
	ans.append(n)
	b = []
	for i in range(1, len(ans)):
		b.append(ans[i] - ans[i - 1])
	print(max(b))


t = int(input())
for i in range(t):
	s = 'R' + input() + 'R'
	d = 0
	gap = 0
	for c in s:
		if c == 'R':
			gap = 0
		else:
			gap += 1
			d = max(gap, d)
	print(d + 1)


for i in range(int(input())):
	x = str(input())
	Max = 0
	y = [0]
	for j in range(len(x)):
		if x[j] == 'R':
			y.append(j + 1)
	for k in range(len(y) - 1):
		if y[k + 1] - y[k] > Max:
			Max = y[k + 1] - y[k]
	print(max(Max, len(x) + 1 - max(y), min(y)))


import sys
input = sys.stdin.readline
for j in range(int(input())):
	a = input()
	a = a + 'R'
	ans = 1
	count = 0
	for j in a:
		if j == 'L':
			count = count + 1
		else:
			count = count + 1
			if count > ans:
				ans = count
			count = 0
	print(ans)


t = int(input())
for i in range(t):
	s = input()
	pos = []
	i = 1
	for i in range(len(s)):
		if s[i] == 'R':
			pos.append(i + 1)
	if len(pos) == 0:
		print(len(s) + 1)
	else:
		pos.append(len(s) + 1)
		diff = [pos[0]]
		for i in range(len(pos) - 1):
			diff.append(pos[i + 1] - pos[i])
		print(max(diff))


import math
for i in range(0, int(input())):
	s = input()
	max_ = 0
	pos = 0
	for i in range(0, len(s)):
		if s[i] == 'R':
			if max_ < i + 1 - pos:
				max_ = i + 1 - pos
			pos = i + 1
	if max_ < len(s) + 1 - pos:
		max_ = len(s) + 1 - pos
	print(max_)


for _ in range(int(input())):
	s = str(input())
	c = 0
	ans = 0
	for i in range(len(s)):
		if s[i] != 'R':
			c += 1
		else:
			c += 1
			ans = max(c, ans)
			c = 0
	c += 1
	ans = max(c, ans)
	print(ans)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

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

def invr():
	return map(int, input().split())
tests = inp()
testcount = 0
while testcount < tests:
	seq = insr()
	i = 0
	arr = []
	count = 0
	while i < len(seq):
		if seq[i] == 'L':
			count += 1
			i += 1
			if i == len(seq):
				arr.append(count)
		else:
			arr.append(count)
			count = 0
			i += 1
	print(max(arr) + 1)
	testcount += 1


def solution(s):
	d = 0
	l = -1
	for i in range(len(s)):
		if s[i] == 'R':
			d = max(d, i - l)
			l = i
	d = max(d, len(s) - l)
	return d

def main():
	t = eval(input())
	for _ in range(t):
		s = input()
		print(solution(s))
main()


from collections import defaultdict
t = int(input())
for _ in range(t):
	s = input() + 'R'
	current = 1
	steps = 0
	for (i, c) in enumerate(s):
		if c == 'R':
			steps = max(steps, current)
			current = 1
		else:
			current += 1
	print(steps)


def run(s):
	s += 'R'
	max_run = 0
	current_run = 1
	for c in s:
		if c == 'R':
			max_run = max(max_run, current_run)
			current_run = 1
		else:
			current_run += 1
	return max_run
testcase = int(input())
for _ in range(testcase):
	s = input()
	ans = run(s)
	print(ans)


def find_d(s):
	s = 'R' + s + 'R'
	_max_ = 1
	counter = 1
	for symbol in s:
		if symbol == 'R':
			if _max_ < counter:
				_max_ = counter
			counter = 1
		else:
			counter += 1
	print(_max_)
n = int(input())
for _ in range(n):
	s = input()
	find_d(s)


t = int(input())
while t > 0:
	s = input()
	flag = 0
	dp = [0]
	for i in range(len(s)):
		if s[i] == 'L':
			flag += 1
			if i == len(s) - 1:
				dp.append(flag)
		else:
			dp.append(flag)
			flag = 0
	print(max(dp) + 1)
	t -= 1


t = int(input())
while t > 0:
	t -= 1
	s = input()
	m = 0
	c = 1
	p = s[0]
	for i in s:
		if i == 'L':
			c += 1
		else:
			if c > m:
				m = c
			c = 1
	if c > m:
		m = c
	print(m)


for _ in range(int(input())):
	s = input()
	arr = []
	cnt = 0
	if s[0] == 'L':
		i = 0
		while i < len(s) and s[i] == 'L':
			i += 1
		arr.append(i)
		for j in range(i, len(s) - 1):
			if s[j] == s[j + 1] == 'L':
				cnt += 1
			elif s[j] != s[j + 1]:
				arr.append(cnt + 1)
				cnt = 0
		if s[-1] == 'L':
			arr.append(cnt + 1)
		else:
			arr.append(cnt)
	else:
		for i in range(len(s) - 1):
			if s[i] == s[i + 1] == 'L':
				cnt += 1
			elif s[i] != s[i + 1]:
				arr.append(cnt + 1)
				cnt = 0
		if s[-1] == 'L':
			arr.append(cnt + 1)
		else:
			arr.append(cnt)
	print(max(arr) + 1)


data = []
n = int(input())
for i in range(n):
	data.append(input())

def count_max(path):
	m = 0
	c = 0
	for i in path:
		if i == 'L':
			c += 1
		else:
			if c > m:
				m = c
			c = 0
	return m + 1 if c < m else c + 1
for i in data:
	print(count_max(i))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	s = si()
	l = []
	x = []
	c = 0
	p = list(s)
	p.insert(0, 0)
	p.append(1)
	for i in range(0, len(p)):
		if p[i] == 'R' or p[i] == 1 or p[i] == 0:
			l.append(i)
			c = c + 1
	if c == 0:
		print(len(s))
	elif s.find('R') == -1:
		print(len(s) + 1)
	else:
		for i in range(1, len(l)):
			x.append(l[i] - l[i - 1])
		print(max(x))


t = int(input())
for i in range(t):
	s = input()
	curm = 0
	ma = 0
	for c in s:
		if c == 'L':
			curm += 1
		else:
			if curm > ma:
				ma = curm
			curm = 0
	if curm > ma:
		ma = curm
	print(ma + 1)


t = int(input())
while t:
	t = t - 1
	st = [s for s in input()]
	st.append('F')
	st.insert(0, 'R')
	is_r = -1
	n = len(st)
	x = []
	last = n - 1
	for i in range(n - 1, -1, -1):
		if st[i] == 'R':
			x.append(last - i)
			last = i
	print(max(x))


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt
import math
from itertools import permutations

def main():
	for t in range(int(input())):
		s = input().rstrip()
		n = len(s)
		r = [0]
		for i in range(n):
			if s[i] == 'R':
				r.append(i + 1)
		r.append(n + 1)
		ma = 0
		for i in range(len(r) - 1):
			ma = max(ma, r[i + 1] - r[i])
		print(ma)
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):
	s = input()
	n = len(s)
	pos = []
	for i in range(n):
		if s[i] == 'R':
			pos.append(i)
	d = 0
	if len(pos) == 0:
		print(len(s) + 1)
	elif len(pos) == 1:
		print(max(pos[0] + 1, n - pos[0]))
	else:
		for i in range(len(pos)):
			if i == 0:
				d = max(d, pos[i] + 1)
			elif i == len(pos) - 1 and i is not 0:
				d = max(d, n - pos[i], pos[i] - pos[i - 1])
			else:
				d = max(d, pos[i] - pos[i - 1])
		print(d)


t = int(input())
for _ in range(t):
	A = input()
	counter = 0
	max_counter = 0
	for i in range(len(A)):
		if A[i] == 'L':
			counter += 1
		else:
			counter = 0
		if counter > max_counter:
			max_counter = counter
	print(max_counter + 1)


n = int(input())
for i in range(n):
	t = input().strip()
	print(max([len(v) for v in t.split('R')]) + 1)


def main():
	global STR, N, WAS
	cnt = int(input())
	for i in range(cnt):
		STR = 'R' + input()
		N = len(STR)
		mstep = 0
		t = 0
		for i in range(N - 1, -1, -1):
			if STR[i] == 'R':
				t = i
				break
		mstep = N - t
		if mstep < N:
			for i in range(t, -2, -1):
				if i == -1:
					print(mstep)
					break
				if STR[i] == 'R':
					mstep = max(t - i, mstep)
					t = i
		else:
			print(mstep)
main()


t = int(input())
for i in range(t):
	inp = input()
	cnt = 0
	maxi = 0
	for j in range(len(inp)):
		if inp[j] == 'L':
			cnt += 1
			maxi = max(maxi, cnt)
		else:
			cnt = 0
	print(maxi + 1)


q = int(input())
for i in range(q):
	a = input()
	maxi = len(a) + 1
	mini = -1
	c = []
	for i in range(len(a)):
		if a[i] == 'R':
			c.append(i + 1)
	if len(c) == 0:
		print(len(a) + 1)
	else:
		mini = -1
		d = []
		d.append(c[0])
		if len(c) == 1:
			d.append(maxi - c[0])
		else:
			for i in range(len(c)):
				if i == len(c) - 1:
					d.append(maxi - c[i])
				else:
					d.append(c[i + 1] - c[i])
		for i in d:
			if i > mini:
				mini = i
		print(mini)


for _ in range(int(input())):
	s = input()
	c = 0
	ans = 0
	f = 0
	for x in s:
		if x == 'L':
			if f == 0:
				c = 1
				f = 1
			else:
				c += 1
		else:
			f = 0
			ans = max(ans, c)
			c = 0
	if c != 0:
		ans = max(ans, c)
		c = 0
	print(ans + 1)


t = int(input())
for case_num in range(t):
	s = input()
	s2 = 'R' + s + 'R'
	a = []
	for i in range(len(s2)):
		if s2[i] == 'R':
			a.append(i)
	ans = 1
	for i in range(len(a) - 1):
		ans = max(ans, a[i + 1] - a[i])
	print(ans)


import collections
for _ in range(int(input())):
	s = input() + 'R'
	pre = -1
	MAX = 0
	for (i, x) in enumerate(s):
		if x == 'R':
			MAX = max(MAX, i - pre)
			pre = i
	print(MAX)


t = int(input())
for i in range(0, t):
	s = input()
	l = len(s)
	d = 1
	initialpos = -1
	for k in range(0, l):
		if s[k] == 'R':
			if k - initialpos > d:
				d = k - initialpos
			initialpos = k
		if k == l - 1:
			if l - initialpos > d:
				d = l - initialpos
	print(d)


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	if 'R' not in s:
		print(n + 1)
	else:
		prev = -1
		ans = 0
		for i in range(n):
			if s[i] == 'R':
				ans = max(ans, i - prev)
				prev = i
		ans = max(ans, n - prev)
		print(ans)


t = int(input())
for you in range(t):
	l = input()
	li = [0]
	for i in range(len(l)):
		if l[i] == 'R':
			li.append(i + 1)
	li.append(len(l) + 1)
	lo = []
	for i in range(len(li) - 1):
		lo.append(li[i + 1] - li[i])
	print(max(lo))


def run():
	s = input()
	st = 0
	mx = 0
	while st < len(s):
		if s[st] == 'R':
			st += 1
		else:
			en = st + 1
			while en < len(s) and s[en] == 'L':
				en += 1
			mx = max(mx, en - st)
			st = en
	print(mx + 1)
tt = int(input())
while tt > 0:
	tt -= 1
	run()


for _ in [0] * int(input()):
	str = input()
	a = 1
	aray = []
	for j in str:
		if j == 'L':
			a += 1
		else:
			if a:
				aray.append(a)
			a = 1
	if a:
		aray.append(a)
	print(max(aray))


t = int(input())
for _ in range(t):
	st = input()
	(d, i, flag) = (1, 0, 0)
	while i < len(st):
		if st[i] == 'L':
			flag = 1
			j = i + 1
			p = 1
			while j < len(st) and st[j] == 'L':
				p += 1
				j += 1
			d = p if p > d else d
			i += j - i - 1
		i += 1
	print(d + 1) if flag else print(d)


t = int(input())
for _ in range(t):
	s = str(input())
	(p1, p2) = (0, -1)
	for i in range(len(s)):
		if s[i] == 'R':
			if i - p2 > p1:
				p1 = i - p2
			p2 = i
		else:
			p1 = p1
	if p1 == 0:
		print(len(s) + 1)
	else:
		print(max(p1, len(s) - p2))


for _ in range(int(input())):
	s = input()
	cou = 0
	cou1 = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if cou > cou1:
				cou1 = cou
			cou = 0
		elif s[i] == 'L':
			cou += 1
	if cou > cou1:
		cou1 = cou
	print(cou1 + 1)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	a = [i for i in input()]
	ind = [-1]
	for i in range(len(a)):
		if a[i] == 'R':
			ind.append(i)
	ind.append(len(a))
	maxx = 0
	for i in range(1, len(ind)):
		maxx = max(maxx, ind[i] - ind[i - 1])
	print(maxx)


for _ in range(int(input())):
	s = input()
	li = [0]
	for (i, j) in enumerate(s, 1):
		if j == 'R':
			li.append(i)
	li.append(len(s) + 1)
	ans = 0
	for i in range(1, len(li)):
		ans = max(ans, li[i] - li[i - 1])
	print(ans)


t = int(input())
for _ in range(t):
	jumps = input()
	dist = []
	R = 0
	n = len(jumps)
	for i in range(n):
		if jumps[i] == 'R':
			dist.append(i + 1 - R)
			R = i + 1
	dist.append(n + 1 - R)
	print(max(dist))


t = int(input())
for i in range(t):
	s = list(input())
	if 'L' not in s:
		print(1)
		continue
	else:
		m = 0
		count = 0
		for i in range(len(s)):
			count += 1
			if s[i] == 'R':
				if count > m:
					m = count
				count = 0
		if count >= m:
			m = count + 1
		print(m)


n = int(input())
for x in range(n):
	s = str(input())
	il = 0
	mxl = 0
	for y in range(0, len(s)):
		if s[y] == 'L':
			il += 1
		else:
			if il >= mxl:
				mxl = il + 1
			il = 0
	if il >= mxl:
		mxl = il + 1
	print(mxl)


def run():
	s = 'R' + input() + 'R'
	flag = 0
	ans = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			temp = i - flag
			ans = max(ans, temp)
			flag = i
	print(ans)
for i in range(int(input())):
	run()


T = int(input())
for z in range(T):
	A = str(input())
	N = len(A)
	c = 1
	tmp = 0
	for i in range(N):
		if A[i] == 'L':
			tmp = tmp + 1
		else:
			if tmp + 1 > c:
				c = tmp + 1
			tmp = 0
	if tmp + 1 > c:
		c = tmp + 1
	print(c)


t = int(input())
i = 0
while i < t:
	n = input()
	m = len(n)
	count = 0
	ans = 0
	for x in n:
		if x == 'L':
			count = count + 1
		elif x == 'R':
			count = count + 1
			ans = max(ans, count)
			count = 0
	count = count + 1
	ans = max(ans, count)
	print(ans)
	i = i + 1


import sys
import heapq
input = sys.stdin.readline
from collections import Counter, defaultdict

def inp():
	return int(input())

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

def main():
	chars = input().strip()
	prev = -1
	mi_n = 0
	for i in range(len(chars)):
		if chars[i] == 'R':
			mi_n = max(mi_n, i - prev)
			prev = i
	if prev == -1:
		print(len(chars) + 1)
	else:
		print(max(mi_n, len(chars) - prev))
t = inp()
for _ in range(t):
	main()


t = int(input())
for i in range(t):
	S = list(input())
	maxstep = 0
	count = 0
	for elem in S:
		if elem == 'L':
			count += 1
		else:
			if count > maxstep:
				maxstep = count
			count = 0
	else:
		if S.pop() == 'L':
			if count > maxstep:
				maxstep = count
	print(maxstep + 1)


def inp_n():
	return int(input())

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

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

def is_odd(n):
	if n & 1:
		return True
	return False

def is_prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
from collections import defaultdict
import math
for _ in range(inp_n()):
	n = input()
	l = len(n)
	c = -1
	m = 0
	for i in range(0, l):
		if n[i] == 'R':
			m = max(m, i - c)
			c = i
	m = max(m, l - c)
	print(m)


t = int(input())
for tt in range(t):
	s = input()
	n = len(s)
	a = [0]
	for x in range(n):
		if s[x] == 'R':
			a.append(x + 1)
	a.append(n + 1)
	m = len(a) - 1
	c = []
	for x in range(m):
		c.append(a[x + 1] - a[x])
	print(max(c))


from sys import stdin
t = int(input())
for _ in range(t):
	(seq,) = stdin.readline().split()
	seq += 'R'
	seq = 'R' + seq
	rights = []
	for s in range(len(seq)):
		if seq[s] == 'R':
			rights.append(s)
	max_dif = 0
	for i in range(len(rights) - 1):
		if rights[i + 1] - rights[i] > max_dif:
			max_dif = rights[i + 1] - rights[i]
	print(max_dif)


t = int(input())
for _ in range(t):
	s = input()
	d = 1
	internal = 1
	for cell in s:
		if cell == 'R':
			internal = 1
		else:
			internal += 1
		d = max(internal, d)
	print(d)


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	Max = 0
	local = 0
	for j in range(n):
		if s[j] == 'L':
			local += 1
		else:
			Max = max(Max, local)
			local = 0
	Max = max(Max, local)
	print(Max + 1)


for _ in range(int(input())):
	s = input()
	n = len(s)
	count = 0
	mini = 0
	for i in range(n):
		if s[i] == 'L':
			count += 1
		else:
			count += 1
			mini = max(count, mini)
			count = 0
	mini = max(count + 1, mini)
	print(mini)


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	moves = 'R' + str(input().strip()) + 'R'
	(prev, ans) = (0, 0)
	for (idx, char) in enumerate(moves):
		if char == 'R':
			ans = max(ans, idx - prev)
			prev = idx
	print(ans)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())
sys.setrecursionlimit(10000)

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		l = ['R'] + list(input()) + ['R']
		n = len(l)
		count = 0
		ans = 0
		for x in range(n):
			if l[x] == 'R':
				ans = max(count + 1, ans)
				count = 0
			else:
				count += 1
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
Ma = 100000000000
for _ in range(I()):
	main()


for _ in range(int(input())):
	arr = list(input())
	count = 0
	ans = 0
	for k in range(len(arr)):
		if arr[k] == 'L':
			count += 1
			ans = max(ans, count)
		else:
			count = 0
	print(ans + 1)


n = int(input())
for x in range(n):
	t = input()
	l = -1
	maxs = 0
	for xy in range(len(t)):
		if t[xy] == 'R':
			maxs = max(xy - l, maxs)
			l = xy
	maxs = max(len(t) - l, maxs)
	print(maxs)


n = int(input())
for i in range(n):
	st = input()
	pos = [0]
	for j in range(len(st)):
		if st[j] == 'R':
			pos.append(j + 1)
	pos.append(len(st) + 1)
	temp = 0
	for j in range(1, len(pos)):
		temp = max(temp, pos[j] - pos[j - 1])
	print(temp)


def main():
	t = int(input())
	for _ in range(t):
		s = input()
		pos = [0]
		for (i, ch) in enumerate(s):
			if ch == 'R':
				pos.append(i + 1)
		pos.append(len(s) + 1)
		d = 0
		for i in range(len(pos) - 1, 0, -1):
			d = max(d, pos[i] - pos[i - 1])
		print(d)
main()


T = int(input())
for x in range(T):
	string = ['R']
	y = input()
	s = 1
	for z in y:
		string.append(z)
		s = s + 1
	string.append('R')
	s = s + 1
	temp = 0
	diff = 0
	for a in range(1, s):
		if string[a] == 'R':
			if a - diff > temp:
				temp = a - diff
				diff = a
			else:
				diff = a
	print(temp)


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
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()):
	s = st()
	n = len(s)
	l = [0 for i in range(n + 2)]
	d = -1
	last = n + 1
	for i in range(len(s), 0, -1):
		if s[i - 1] == 'R':
			l[i] = last - i
			last = i
			d = max(d, l[i])
	d = max(d, last - 0)
	print(d if d > 0 else n + 1)


t = int(input())
for i in range(t):
	s = input()
	loc_count = 0
	glo_count = 0
	for i in range(len(s)):
		if s[i] == 'L':
			loc_count += 1
		else:
			loc_count = 0
		glo_count = max(loc_count, glo_count)
	print(glo_count + 1)


for i in [*open(0)][1:]:
	print(max(map(len, i.replace('\n', '').split('R'))) + 1)


t = int(input())
while t:
	s = input()
	l = 0
	ml = 0
	for i in range(len(s)):
		ml = max(l, ml)
		if s[i] == 'L':
			l += 1
		else:
			l = 0
		ml = max(l, ml)
	print(ml + 1)
	t -= 1


t = int(input())
for i in range(t):
	st = input()
	ans = 0
	maans = 0
	for j in range(len(st)):
		if st[j] == 'L':
			ans += 1
		else:
			ans = 0
		maans = max(ans, maans)
	print(maans + 1)


from sys import stdin, stdout
(_input, _print) = (stdin.readline, stdout.write)
(_range, _int, _list, _len, _str) = (range, int, list, len, str)

def solution():
	for _ in _range(_int(_input())):
		s = _input().replace('\n', '').rstrip('R').lstrip('R')
		n = _len(s)
		if n != 0:
			arr = [0] * n
			arr[0] = 1
			for i in _range(1, n):
				if s[i] == 'L' and s[i - 1] == 'L':
					arr[i] = arr[i - 1] + 1
				elif s[i] == 'L' and s[i - 1] != 'L':
					arr[i] = 1
				else:
					arr[i] = 0
			print(max(arr) + 1)
		else:
			print(1)
solution()


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	lst = stdin.readline()
	k = 0
	ans = 0
	for j in lst:
		if j == 'L':
			k += 1
		if j == 'R':
			ans = max(ans, k + 1)
			k = 0
	ans = max(ans, k + 1)
	stdout.write(str(ans) + '\n')


for _ in range(int(input())):
	string = str(input())
	tamanho_das_sequencias_L = []
	for sequencia in string.split('R'):
		if sequencia:
			tamanho_das_sequencias_L.append(len(sequencia))
	if tamanho_das_sequencias_L:
		tamanho_das_sequencias_L.sort()
		print(tamanho_das_sequencias_L[-1] + 1)
	else:
		print(1)


t = int(input())
for _ in range(t):
	k = [len(x) for x in input().split('R')]
	print(max(k) + 1)


def calcJumps(seq):
	jumps = 1
	maxLength = 0
	length = 0
	for i in range(len(seq)):
		if seq[i] == 'L':
			length += 1
		else:
			if length > maxLength:
				maxLength = length
			length = 0
	if length > maxLength:
		maxLength = length
	if maxLength > 0:
		jumps = maxLength + 1
	return jumps
t = int(input())
results = []
for i in range(t):
	seq = input()
	results.append(calcJumps(seq))
for i in range(t):
	print(results[i])


import math
t = int(input())
ans = []
for i in range(t):
	k = 0
	d = 1
	s = str(input())
	for j in range(len(s)):
		if s[j] == 'L':
			k += 1
		elif k != 0:
			d = max(k + 1, d)
			k = 0
	if k != 0:
		d = max(k + 1, d)
	ans.append(d)
for i in range(len(ans)):
	print(ans[i])


for _ in range(int(input())):
	s = input()
	s = 'R' + s + 'R'
	prev = 0
	l = len(s)
	maxx = 0
	for i in range(1, l):
		if s[i] == 'R':
			maxx = max(maxx, i - prev)
			prev = i
	print(maxx)


t = int(input().strip())
for _ in range(t):
	s = input().strip()
	s += 'R'
	counter = 0
	ans = 0
	for i in range(len(s)):
		counter += 1
		if s[i] == 'R':
			ans = max(ans, counter)
			counter = 0
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	mc = 0
	count = 0
	for char in s:
		if char == 'R':
			count = 0
		elif char == 'L':
			count += 1
		mc = max(mc, count)
	print(mc + 1)


import sys
import math
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input()
	maxi = 0
	n = len(s)
	j = 0
	for i in range(n):
		maxi += 1
		if s[i] == 'R':
			j = i
			break
	diff = 0
	l_index = j
	for i in range(j + 1, n):
		diff += 1
		if s[i] == 'R':
			if diff > maxi:
				maxi = diff
			diff = 0
			l_index = i
	n -= 1
	if n - l_index > maxi:
		maxi = n - l_index
	print(maxi)


def jump(s):
	contl = 0
	d = 0
	for e in range(len(s)):
		if s[e] == 'L':
			contl += 1
		else:
			if contl > d:
				d = contl
			contl = 0
	if contl > d:
		d = contl
	return d + 1
t = int(input())
for a in range(t):
	s = input()
	print(jump(s))


t = int(input())
for i in range(t):
	s = list(input().split())
	l1 = []
	for j in range(len(s[0])):
		if s[0][j] == 'R':
			l1.append(j)
	if len(l1) >= 1:
		x = abs(l1[0] + 1)
		for j in range(len(l1) - 1):
			x = max(x, abs(l1[j] - l1[j + 1]))
		x = max(x, abs(l1[len(l1) - 1] - len(s[0])))
		print(x)
	else:
		print(len(s[0]) + 1)


for i in range(int(input())):
	s = input()
	s = '#' + s + '#'
	n = len(s)
	mx = -87654333334
	r = n - 1
	step = 0
	for i in range(n - 2, -1, -1):
		if s[i] == 'R' or s[i] == '#':
			if step <= 0:
				mx = r - i
				step = mx
			else:
				step = mx
			r = i
		else:
			step -= 1
	print(mx)


t = int(input())
for i in range(t):
	s = input()
	res = [0]
	indices = [0]
	for (i, c) in enumerate(s):
		if c == 'R':
			res.append(i + 1 - indices[-1])
			indices.append(i + 1)
	res.append(len(s) + 1 - indices[-1])
	print(max(res))


n = int(input())

def ls(lista):
	aux = []
	parte = ''
	for i in range(len(lista)):
		if lista[i] != 'R':
			parte += lista[i]
		elif parte != '':
			aux.append(parte)
			parte = ''
	if parte != '':
		aux.append(parte)
	aux.sort(reverse=True)
	return aux
for i in range(n):
	caso = list(input())
	aux = ls(caso)
	resposta = 0
	if len(aux) > 0:
		resposta = len(aux[0])
	print(resposta + 1)


for _ in range(int(input())):
	L = [*map(str, input().split('R'))]
	print(max((len(i) for i in L)) + 1)


for i in range(int(input())):
	s = input()
	l = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	ans = float('-inf')
	for i in range(1, len(l)):
		ans = max(ans, l[i] - l[i - 1])
	print(ans)


t = int(input())
for T in range(t):
	s = input()
	l = list(s.split('R'))
	ans = len(l[0])
	for i in l:
		ans = max(ans, len(i))
	print(ans + 1)


def sol():
	T = int(input())
	for i in range(T):
		bridge = input()
		bridge += 'R'
		prev_r = -1
		max_interval = 0
		for i in range(len(bridge)):
			if bridge[i] == 'R':
				interval = i - prev_r
				prev_r = i
				max_interval = max(max_interval, interval)
		print(max_interval)
sol()


for i in range(int(input())):
	a = input()
	n = len(a)
	ans = 1
	k = -1
	for i in range(n):
		if a[i] == 'R':
			ans = max(ans, i - k)
			k = i
	if k != n - 1:
		ans = max(n - k, ans)
	print(ans)


from sys import stdin

def solve(t):
	(idxs, n, ans) = ([0], len(t), float('-inf'))
	for i in range(n):
		if t[i] == 'R':
			idxs.append(i + 1)
	idxs.append(n + 1)
	for i in range(len(idxs) - 1):
		ans = max(ans, idxs[i + 1] - idxs[i])
	return ans

def main():
	r = stdin.readline
	cases = int(r())
	for case in range(cases):
		t = r().strip()
		print(solve(t))
main()


def possible(s):
	max_ = 0
	val = -1
	for i in range(len(s)):
		if s[i] == 'R':
			max_ = max(max_, i - val)
			val = i
	max_ = max(max_, len(s) - val)
	return max_
for _ in range(int(input())):
	s = input()
	print(possible(s))


from sys import stdin
t = int(input())
for _ in range(t):
	string = stdin.readline().strip()
	maxdist = 1
	prev = -1
	for (i, char) in enumerate(string):
		if char == 'R':
			maxdist = max(maxdist, i - prev)
			prev = i
	maxdist = max(maxdist, len(string) - prev)
	print(maxdist)


def ok(s, x, n):
	i = -1
	while i < n:
		if i + x >= n:
			return 1
		b = 0
		for j in range(1, x + 1):
			if s[i + j] == 'R':
				i += j
				b = 1
				break
		if b == 0:
			return 0

def solve():
	s = input().strip()
	n = len(s)
	lb = 1
	rb = n + 1
	while lb < rb:
		mb = (lb + rb) // 2
		if ok(s, mb, n):
			rb = mb
		else:
			lb = mb + 1
	print(lb)
t = int(input())
while t:
	t -= 1
	solve()


t = int(input())
for k in range(t):
	st = input()
	n = len(st)
	prev_ind = n
	d = 0
	for i in range(1, n + 1):
		if st[n - i] == 'R':
			cur_d = prev_ind - (n - i)
			prev_ind = n - i
			if cur_d > d:
				d = cur_d
	cur_d = prev_ind - -1
	if cur_d > d:
		d = cur_d
	if d == 0:
		d = n + 1
	print(d)


from sys import stdin
for _ in range(int(stdin.readline())):
	s = stdin.readline().strip()
	s = 'R' + s + 'R'
	m = 0
	pre = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			m = max(i - pre, m)
			pre = i
	print(m)


t = int(input())
for _ in range(t):
	s = input()
	l = []
	n = len(s)
	l.append(0)
	c = 2
	for i in range(n):
		if s[i] == 'R':
			l.append(i + 1)
			c += 1
	l.append(n + 1)
	max = 0
	for i in range(c - 1):
		f = l[i + 1] - l[i]
		if f > max:
			max = f
	print(max)


t = int(input())
d = []
for i in range(0, t):
	b1 = input().split()
	b = list(b1[0])
	max = 1
	i = 0
	j = 0
	while j < len(b):
		if b[i] == b[j]:
			j += 1
		else:
			if max < j - i + 1 and b[i] == 'L':
				max = j - i + 1
			i = j
			j = i + 1
	if max < j - i + 1 and b[i] == 'L':
		max = j - i + 1
	d.append(max)
for i in d:
	print(i)


for _ in range(int(input())):
	s = input()
	t = len(s)
	m = 1
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			m = max(m, t - i)
			t = i
	print(max(m, t + 1))


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

	def maxRepeating(str):
		n = len(str)
		cur_count = 1
		d = {}
		for ele in set(list(str)):
			d[ele] = 0
		for i in range(n):
			if i < n - 1 and str[i] == str[i + 1]:
				cur_count += 1
			else:
				if cur_count > d[str[i]]:
					d[str[i]] = cur_count
				cur_count = 1
		return d
	a = maxRepeating(s)
	if 'L' in a:
		print(a['L'] + 1)
	else:
		print(1)


t = int(input())
for iii in range(t):
	s = input()
	mx = 0
	k = 0
	for i in range(len(s)):
		k += 1
		if s[i] == 'R':
			mx = max(mx, k)
			k = 0
	k += 1
	mx = max(mx, k)
	print(mx)


I = lambda : map(int, input().split())
for _ in range(int(input())):
	n = input()
	c = 0
	k = d = 0
	l = [0]
	for i in range(len(n)):
		if n[i] == 'R':
			l.append(i + 1)
	l.append(i + 2)
	for i in range(1, len(l)):
		d = max(d, l[i] - l[i - 1])
	print(d)


n = int(input())
for _ in range(n):
	s = list(input())
	s2 = [-1] + [i for i in range(len(s)) if s[i] == 'R'] + [len(s)]
	ans = 0
	for i in range(len(s2) - 1):
		ans = max(ans, s2[i + 1] - s2[i])
	print(ans)


t = int(input())
for j in range(t):
	s = input()
	a = list(s)
	b = []
	ind = -1
	for i in range(len(a)):
		if a[i] == 'R':
			b.append(i - ind)
			ind = i
	b.append(len(a) - ind)
	b.sort()
	print(b[len(b) - 1])


for _ in range(int(input())):
	s = input()
	s = 'R' + s + 'R'
	i = 0
	j = 1
	maxx = 0
	while j < len(s):
		while s[j] == 'L':
			j += 1
		maxx = max(maxx, j - i)
		i = j
		j = i + 1
	print(maxx)


t = int(input())
for _ in range(t):
	s = input()
	ma = 0
	c = 0
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'L':
			c += 1
		else:
			c = 0
		ma = max(ma, c)
	print(ma + 1)


import sys
n = int(sys.stdin.readline())
for _ in range(n):
	s = sys.stdin.readline().strip()
	mx = 0
	temp = 0
	for i in s:
		if i == 'L':
			temp += 1
			mx = max(mx, temp)
		else:
			temp = 0
	print(mx + 1)


def main():
	a = str(input())
	n = len(a)
	cnt = 0
	i = 0
	index = 0
	while i < n:
		index = i
		while index < n and a[index] == 'L':
			index += 1
		cnt = max(index - i + 1, cnt)
		i = index + 1
	print(cnt)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


t = int(input())
ans = []
for i in range(t):
	s = str(input())
	mxl = 0
	cnt = 0
	for j in range(len(s)):
		if s[j] == 'L':
			cnt += 1
			mxl = max(cnt, mxl)
		else:
			cnt = 0
	ans.append(mxl + 1)
for k in range(t):
	print(ans[k])


for _ in range(int(input())):
	lst = map(len, input().split('R'))
	print(max(lst) + 1)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	s = input()
	s = 'R' + s + 'R'
	k = 0
	diff = 0
	n = len(s)
	for i in range(1, n):
		if s[i] == 'R':
			ans = i - k
			diff = max(diff, ans)
			k = i
	print(diff)


import collections
import sys
input = sys.stdin.readline
L = ''

def f(d):
	i = 0
	n = len(L)
	while True:
		for j in range(d, 0, -1):
			if i + j >= n + 1:
				return True
			if L[i + j - 1] == 'R':
				i = i + j
				break
		else:
			break
	return False
for _ in range(int(input())):
	L = input().strip()
	(s, e) = (0, len(L) + 2)
	while e - s > 1:
		m = (s + e) // 2
		if f(m):
			e = m
		else:
			s = m
	print(e)


def funcao(chute, ps, n):
	i = ps
	while i < len(lista) - 1:
		if chute + i >= n + 1:
			return True
		j = i
		while j < i + chute:
			j += 1
			if j >= len(lista):
				return True
			elif lista[j] == 'R':
				i = j
		return False
t = int(input())
res = []
k = 0
while k < t:
	lista = list(input())
	n = len(lista)
	menor = n + 1
	l = 1
	r = n + 1
	while l <= r:
		med = int((l + r) / 2)
		if funcao(med, -1, n):
			menor = min(menor, med)
			r = med - 1
		else:
			l = med + 1
	res.append(menor)
	k += 1
for e in res:
	print(e)


for i in range(int(input())):
	a = list(input())
	if 'R' not in a:
		print(len(a) + 1)
	elif 'L' not in a:
		print(1)
	else:
		t = []
		f = -1
		for k in range(len(a)):
			if a[k] == 'R':
				t.append(k - f)
				f = k
		t.append(a[::-1].index('R') + 1)
		print(max(t))


def solve():
	string = input()
	minimum = 0
	skip = string.split('R')
	for s in skip:
		if len(s) + 1 > minimum:
			minimum = len(s) + 1
	print(minimum)
for _ in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	a = list(input())
	cntMax = 0
	cntTmp = 0
	for i in range(len(a)):
		if a[i] == 'L':
			cntTmp += 1
		elif cntTmp != 0:
			cntMax = max(cntMax, cntTmp)
			cntTmp = 0
		cntMax = max(cntMax, cntTmp)
	print(cntMax + 1)


t = int(input())
for c in range(t):
	moves = input()
	l = [0]
	length = len(moves)
	for i in range(length):
		if moves[i] == 'R':
			l.append(i + 1)
	l.append(length + 1)
	jumps = []
	for i in range(1, len(l)):
		jumps.append(l[i] - l[i - 1])
	print(max(jumps))


t = int(input())
flag = 0
res = -1
count = 1
for i in range(t):
	a = list(map(str, input()))
	for j in range(len(a)):
		if a[j] == 'L':
			count += 1
		else:
			res = max(res, count)
			count = 1
	res = max(res, count)
	count = 1
	print(res)
	res = -1


t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	mx = 0
	lst = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			mx = max(mx, i - lst)
			lst = i
	print(mx)


testes = int(input())
for c in range(testes):
	string = input()
	w = 1
	aws = 0
	for v in range(len(string)):
		if string[v] == 'L':
			w += 1
		else:
			aws = max(aws, w)
			w = 1
	aws = max(aws, w)
	print(aws)


for _ in range(int(input())):
	s = input().split('R')
	d = 0
	for i in s:
		d = max(len(i), d)
	print(d + 1)


from collections import defaultdict

def solve(s):
	mp = defaultdict(list)
	for i in range(len(s)):
		if s[i] == 'R':
			mp[s[i]].append(i + 1)
	if len(mp['R']) == 0:
		return len(s) + 1
	l = [0] + list(mp['R']) + [len(s) + 1]
	ans = -1
	for i in range(len(l) - 1, 0, -1):
		if l[i] - l[i - 1] > ans:
			ans = l[i] - l[i - 1]
	return ans
t = int(input())
while t:
	s = input()
	print(solve(s))
	t -= 1


t = int(input())
while t:
	s = input()
	l = [0]
	for i in range(0, len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	m = 0
	l.append(len(s) + 1)
	for i in range(0, len(l) - 1):
		m = max(m, l[i + 1] - l[i])
	print(m)
	t -= 1


t = int(input())
for i in range(t):
	s = input()
	s += 'R'
	last_r = 0
	diff = 0
	for j in range(len(s)):
		if s[j] == 'R':
			temp = j - last_r + 1
			diff = max(diff, temp)
			last_r = j + 1
	print(diff)


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

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

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	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 swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

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

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(councils, a, k):
	summ = 0
	for x in a:
		summ += min(x, councils)
	return summ // councils >= k
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
import bisect as bis
import random
import sys

def solve():
	s = input().rstrip()
	c = 0
	m = 0
	for x in s:
		if x == 'L':
			c += 1
		else:
			m = max(c, m)
			c = 0
	m = max(c, m)
	print(m + 1)
for _ in range(int(input())):
	solve()


def solve():
	s = input()
	mp = 0
	p = 0
	for i in s:
		if i == 'L':
			p += 1
		else:
			mp = max(mp, p)
			p = 0
	mp = max(mp, p)
	print(mp + 1)
for i in range(int(input())):
	solve()


T = int(input())
n = [0] * T
k = [0] * T
ns = [0] * T
for t in range(T):
	k[t] = list(input())
for t in range(T):
	ml = 0
	cl = 0
	for i in k[t]:
		if i == 'L':
			cl += 1
		else:
			ml = max(cl, ml)
			cl = 0
	ml = max(cl, ml)
	print(ml + 1)


def frog(arr):
	max_n = 0
	counts = 0
	for i in range(len(arr)):
		if arr[i] == 'L':
			counts += 1
		else:
			max_n = max(counts, max_n)
			counts = 0
	max_n = max(counts, max_n)
	return max_n + 1
t = int(input())
for i in range(1, t + 1):
	arr = input()
	ans = frog(arr)
	print(ans)


n = int(input())
for i in range(n):
	jumpStr = input().strip()
	answer = -1
	prev = -1
	for j in range(len(jumpStr)):
		if jumpStr[j] == 'R':
			answer = max(answer, j - prev)
			prev = j
	if prev == -1:
		answer = len(jumpStr) - prev
	else:
		answer = max(len(jumpStr) - prev, answer)
	print(answer)


for _ in range(int(input())):
	s = input()
	a = s.split('R')
	ma = 0
	for i in a:
		ma = max(ma, len(i))
	print(ma + 1)


from collections import deque
import sys
sys.setrecursionlimit(5000)
t = int(input().rstrip())
for _ in range(t):
	arr = [ch for ch in input().rstrip()]
	jump = [0]
	i = 0
	while i < len(arr):
		if arr[i] == 'R':
			jump.append(i + 1)
		i = i + 1
	jump.append(len(arr) + 1)
	ans = 0
	for i in range(len(jump) - 1):
		if jump[i + 1] - jump[i] > ans:
			ans = jump[i + 1] - jump[i]
	print(ans)


t = int(input())
for i in range(t):
	s = input()
	max_l = 0
	l = 0
	flg_s = False
	for c in s:
		if c == 'L':
			if flg_s:
				l += 1
			else:
				flg_s = True
				l = 1
		elif flg_s:
			flg_s = False
			if l > max_l:
				max_l = l
	if l > max_l:
		max_l = l
	print(max_l + 1)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		S = input().strip()
		ma = 1
		tmp = 0
		for s in S:
			if s == 'R':
				ma = max(ma, tmp + 1)
				tmp = 0
			else:
				tmp += 1
		ma = max(ma, tmp + 1)
		print(ma)
main()


t = int(input())
for _ in range(t):
	s = input()
	b = [-1] + [x for x in range(len(s)) if s[x] == 'R'] + [len(s)]
	if len(b) == 1:
		print(2)
	else:
		print(max([b[y] - b[y - 1] for y in range(1, len(b))]))


T = int(input())
while T:
	s = input()
	pos = []
	pos.append(0)
	for i in range(len(s)):
		if s[i] == 'R':
			pos.append(i + 1)
	pos.append(len(s) + 1)
	ans = 0
	for i in range(len(pos) - 1):
		ans = max(ans, pos[i + 1] - pos[i])
	print(ans)
	T -= 1


def frog(s):
	count = 0
	maxi = 0
	countl = 0
	for i in range(1, len(s)):
		if s[i] == 'L' and s[i - 1] == s[i]:
			count += 1
		else:
			count = 0
		maxi = max(maxi, count)
	for i in range(len(s)):
		if s[i] == 'L':
			countl += 1
	if maxi == 0:
		if countl > 0:
			return 2
		else:
			return 1
	else:
		return maxi + 2
t = int(input())
for i in range(t):
	s = input()
	print(frog(s))


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	s = I1().strip()
	l = [0]
	n = len(s)
	for i in range(n):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(n + 1)
	m = 0
	for i in range(1, len(l)):
		m = max(m, l[i] - l[i - 1])
	print(m)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(x, y):
	return f(x) // (f(y) * f(x - y))
t = int(input())
for _ in range(t):
	s = list(input())
	s = ['0'] + s + ['0']
	maxi = 0
	posn = 0
	for i in range(1, len(s)):
		if s[i] == '0' or s[i] == 'R':
			maxi = max(i - posn, maxi)
			posn = i
	print(maxi)


t = int(input())
for i in range(t):
	s = input()
	c = 0
	mx = 0
	for j in s:
		if j == 'L':
			c = c + 1
		else:
			mx = max(c, mx)
			c = 0
	mx = max(mx, c)
	print(mx + 1)


def solve(seq):
	result = 0
	prev = -1
	for (i, s) in enumerate(seq):
		if s == 'R':
			result = max(i - prev, result)
			prev = i
	return result

def main():
	t = int(input())
	for i in range(t):
		sequence = list(input())
		sequence.append('R')
		result = solve(sequence)
		print(result)
	return 0
main()


t = int(input())
for i in range(t):
	s = input()
	c = 1
	mc = 1
	flag = True
	if s[0] == 'L':
		c += 1
		mc += 1
	if len(s) > 1:
		for j in range(1, len(s)):
			if s[j] == 'L':
				c += 1
				if c > mc:
					mc = c
			elif s[j] == 'R':
				c = 1
	print(mc)


from __future__ import division, print_function

def main():
	for _ in range(int(input())):
		s = input()
		last = -1
		s += 'R'
		n = len(s)
		mx = -1
		for i in range(n):
			if s[i] == 'R':
				mx = max(mx, i - last)
				last = i
		cout << mx << '\n'
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'
main()


t = int(input())
while t:
	t -= 1
	a = input()
	cnt1 = 0
	cnt = 0
	for x in range(len(a)):
		if a[x] == 'L':
			cnt += 1
		else:
			cnt1 = max(cnt, cnt1)
			cnt = 0
	cnt1 = max(cnt, cnt1)
	print(cnt1 + 1)


t = int(input())
for x in range(t):
	s = input()
	l = []
	l.append(-1)
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i)
	l.append(len(s))
	res = 1
	for i in range(1, len(l)):
		if res < l[i] - l[i - 1]:
			res = l[i] - l[i - 1]
	print(res)


T = int(input())
for t in range(T):
	s = input()
	x = 0
	p = -1
	for j in range(len(s)):
		if s[j] == 'R' and j - p >= x:
			x = j - p
		if s[j] == 'R':
			p = j
	if len(s) - p > x:
		x = len(s) - p
	print(x)


from math import *
inf = 10 ** 10
zzz = int(input())
for zz in range(zzz):
	s = list(input())
	ans = 0
	bal = 0
	for i in s:
		if i == 'L':
			bal += 1
		else:
			ans = max(bal, ans)
			bal = 0
	ans = max(bal, ans)
	print(ans + 1)


t = int(input())
for _ in range(t):
	a = input()
	(s, m, e) = (0, 0, 0)
	for i in a:
		if i == 'R':
			break
		s += 1
	s = s + 1
	for i in range(len(a) - 1, -1, -1):
		if a[i] == 'R':
			break
		e += 1
	e += 1
	prev = s - 1
	m = 0
	for i in range(s, len(a)):
		if a[i] == 'R':
			if m < i - prev:
				m = i - prev
			prev = i
	print(max(s, e, m))


for u in range(int(input())):
	s = input()
	n = len(s)
	(l, ka) = (0, 0)
	for i in range(n):
		if s[i] == 'L':
			l = l + 1
		else:
			ka = max(ka, l)
			l = 0
	if l != 0:
		ka = max(ka, l)
	print(ka + 1)


for i in range(int(input())):
	s = input()
	s = 'R' + s
	ini = len(s)
	dis = -1
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			dis = max(dis, ini - i)
			ini = i
	print(dis)


from sys import stdin
for i in range(int(stdin.readline())):
	s = stdin.readline()[:-1]
	s = 'R' + s + 'R'
	L = [0]
	for i in range(1, len(s)):
		if s[i] == 'R':
			L.append(i)
	L2 = [L[i] - L[i - 1] for i in range(1, len(L))]
	print(max(L2))


for i in range(int(input())):
	s = input()
	c = 0
	mx = 0
	for j in range(len(s)):
		if s[j] == 'L':
			c = c + 1
		else:
			c = 0
		if c > mx:
			mx = c
	print(mx + 1)


for _ in range(int(input())):
	s = 'R' + input() + 'R'
	a = [i for (i, c) in enumerate(s) if c == 'R']
	d = [a[i] - a[i - 1] for i in range(1, len(a))]
	print(max(d))


import math
t = int(input())
for _ in range(t):
	arr = list(input().strip())
	arr.append('R')
	arr.insert(0, 'R')
	leng = 0
	ind = 0
	j = 0
	for i in range(len(arr)):
		if arr[i] == 'R':
			ind = j
			j = i
		if j - ind > leng:
			leng = j - ind
	print(leng)


a = int(input())
for i in range(a):
	b = input()
	c = len(b)
	d = 0
	e = 0
	for j in range(c):
		if b[j] == 'R':
			e = 0
		else:
			e = e + 1
		if e > d:
			d = e
	print(d + 1)


def solve(s):
	if 'L' not in s:
		return 1
	if 'R' not in s:
		return len(s) + 1
	ans = 0
	r = []
	for i in range(len(s)):
		if s[i] == 'R':
			r.append(i)
	md = 0
	for i in range(len(r) - 1):
		md = max(r[i + 1] - r[i], md)
	return max(r[0] + 1, len(s) - r[-1], md)

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


for _ in range(int(input())):
	a = list(input())
	md = 0
	count = 0
	if a.count('R') == 0:
		print(len(a) + 1)
	elif a.count('L') == 0:
		print('1')
	else:
		rr = a[::-1].index('R') + 1
		lr = a.index('R') + 1
		for i in range(a.index('R'), len(a) - a[::-1].index('R')):
			if a[i] == 'R':
				if count > md:
					md = count
				count = 0
			else:
				count += 1
		print(max(rr, lr, md + 1))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	s = sys.stdin.readline().split()[0]
	s = 'R' + s + 'R'
	prev = 0
	maxi = 0
	acc = 0
	for i in range(len(s)):
		if s[i] == 'R':
			maxi = max(maxi, acc)
			acc = 0
		else:
			acc += 1
	print(maxi + 1)


t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	maxGap = 0
	gap = 1
	for c in s:
		if c == 'R':
			maxGap = max(maxGap, gap)
			gap = 1
		else:
			gap += 1
	print(maxGap)


for _ in range(int(input())):
	a = input()
	arr = []
	for i in range(len(a)):
		if a[i] == 'R':
			arr.append(i + 1)
	arr.append(len(a) + 1)
	ans = min(arr)
	if len(arr) == 1:
		print(arr[0])
	else:
		for i in range(len(arr) - 1):
			ans = max(ans, arr[i + 1] - arr[i])
		print(ans)


t = int(input())
for _ in range(t):
	r = [0]
	s = input()
	for (idx, i) in enumerate(s):
		if i == 'R':
			r.append(idx + 1)
	r.append(len(s) + 1)
	lens = len(r)
	dist = 0
	for i in range(lens - 1):
		dist = max(dist, r[i + 1] - r[i])
	print(dist)


def solve():
	t = int(input())
	for _ in range(t):
		s = input()
		s += 'R'
		cur = 0
		max_con = 0
		for c in s:
			if c == 'R':
				max_con = max(max_con, cur)
				cur = 0
			else:
				cur += 1
		print(max_con + 1)
solve()


t = int(input())
for i in range(t):
	s = 'R' + input()
	maxd = 0
	ref = len(s)
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R' and ref - i > maxd:
			maxd = ref - i
			ref = i
		elif s[i] == 'R':
			ref = i
	print(maxd)


for _ in range(int(input())):
	x = input()
	if len(x) == 1:
		if x == 'L':
			print(2)
		else:
			print(1)
	else:
		margin = 0
		prev = -1
		for i in range(len(x)):
			if x[i] == 'R' and i - prev > margin:
				margin = i - prev
				prev = i
			elif x[i] == 'R':
				prev = i
		if len(x) - prev > margin:
			margin = len(x) - prev
		print(margin)


t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	j = 0
	c = 0
	for a in s:
		if a == 'R':
			c = max(c, j)
			j = 0
		else:
			j = j + 1
	print(c + 1)


def jumps(path):
	(ans, count) = (0, 1)
	for e in path[::-1]:
		if e != 'R':
			count += 1
		else:
			count = 1
		ans = max(ans, count)
	return ans
t = int(input())
for _ in range(t):
	string = input()
	print(jumps(string))


t = int(input())
out = []
for i in range(0, t):
	s = input()
	(value, large) = (0, 0)
	for char in s:
		if char == 'L':
			value += 1
		else:
			large = max(large, value)
			value = 0
	large = max(large, value)
	out.append(large + 1)
for x in out:
	print(x)


def main():
	s = input()
	s += 'R'
	dist = 0
	max_jump = 0
	for i in range(len(s)):
		dist += 1
		if s[i] == 'R':
			max_jump = max(dist, max_jump)
			dist = 0
	return max_jump
t = int(input())
for _ in range(t):
	print(main())


def main():
	q = int(input())
	for _ in range(q):
		s = 'R' + input() + 'R'
		last = 0
		inc = 0
		for x in range(len(s)):
			if s[x] == 'R':
				inc = max(inc, x - last)
				last = x
		print(inc)
main()


def find_minimum_max_jump(string):
	longest_L_seq = 0
	curr = 0
	for ch in string:
		if ch == 'L':
			curr += 1
			longest_L_seq = max(longest_L_seq, curr)
		else:
			curr = 0
	return longest_L_seq + 1
t = int(input())
for i in range(t):
	string = input()
	print(find_minimum_max_jump(string))


def q():
	a = input()
	p = a.find('R') + 1
	b = []
	a = list(a)
	c = len(a)
	if c == 1 and a[0] == 'R':
		print(1)
		return 0
	elif c == 1 and a[0] == 'L':
		print(2)
		return 0
	else:
		for i in range(c):
			if a[i] == 'R':
				b.append(i)
		if len(b) == 1:
			if a.index('R') + 1 > c - b[0]:
				print(a.index('R') + 1)
			else:
				print(c - b[0])
			return 0
		if len(b) == 0:
			print(c + 1)
			return 0
		b.reverse()
		for i in range(len(b) - 1):
			b[i] = b[i] - b[i + 1]
		e = max(b)
		d = list(a)[:]
		d.reverse()
		r = d.index('R')
		print(max(p, r + 1, e))
		return 0
a = eval(input())
for i in range(a):
	q()


n = int(input())
for i in range(n):
	l = list(input())
	mx = 1
	streak = 1
	for j in range(len(l)):
		if l[j] == 'R':
			mx = max(mx, streak)
			streak = 1
		else:
			streak += 1
	mx = max(mx, streak)
	print(mx)


def rec(s):
	steps = 1
	l = []
	for i in s:
		if i == 'L':
			steps += 1
		else:
			l.append(steps)
			steps = 1
	l.append(steps)
	return max(l)
t = int(input())
for _ in range(t):
	s = input()
	print(rec(s))


for _ in range(int(input())):
	s = input()
	last = -1
	s += 'R'
	n = len(s)
	mx = -1
	for i in range(n):
		if s[i] == 'R':
			mx = max(mx, i - last)
			last = i
	print(mx)


def find(val):
	li = list(val)
	li.append('R')
	li = ['R'] + li
	index = 0
	ans = float('-inf')
	for i in range(len(li)):
		if li[i] == 'R':
			ans = max(ans, i - index)
			index = i
	return ans
x = int(input())
for i in range(x):
	print(find(input()))


def find_answer(lenth):
	ans = 0
	a = 1
	for i in lenth:
		if i == 'L':
			a += 1
		else:
			ans = max(ans, a)
			a = 1
	ans = max(ans, a)
	print(ans)
n = int(input())
for i in range(n):
	a = input()
	find_answer(a)


for i in range(int(input())):
	l = input()
	le = len(l)
	d = -1
	j = -1
	k = -1
	for i in range(le):
		if l[i] == 'R':
			d = max(abs(j - k), d)
			(j, k) = (k, i)
	d = max(abs(j - k), d)
	d = max(d, abs(le - k))
	if d == -1:
		print(le + 1)
	else:
		print(d)


test = int(input())
for index in range(0, test):
	inp = input()
	temp = []
	temp.append(0)
	num = len(inp)
	for index in range(0, num):
		if inp[index] == 'R':
			temp.append(index + 1)
	temp.append(num + 1)
	maximum = 0
	lamba = len(temp)
	for index in range(0, lamba - 1):
		maximum = max(temp[index + 1] - temp[index], maximum)
	print(maximum)


import sys
all_data = sys.stdin.readline()
n = int(all_data)
for i in range(1, n + 1):
	s = sys.stdin.readline()
	s = 'R' + s[-1::-1] + 'R'
	max_dis = 0
	last = 1
	for j in range(1, len(s)):
		if s[j] == 'R':
			max_dis = max(j - last, max_dis)
			last = j
	print(max_dis)


t = int(input())
l1 = []
for i in range(t):
	l = []
	s = input()
	for j in range(len(s)):
		if s[j] == 'R':
			l.append(j)
	l1.append([l, len(s)])
for i in l1:
	if len(i[0]) == 0:
		print(i[1] + 1)
	else:
		l2 = [i[0][0] + 1]
		for j in range(1, len(i[0])):
			l2.append(i[0][j] - i[0][j - 1])
		l2.append(i[1] - i[0][-1])
		l2.sort()
		print(l2[-1])


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l
import statistics

def main():
	t = inin()
	for _ in range(t):
		s = sin()
		a = []
		n = len(s)
		for i in range(n):
			if s[i] == 'R':
				a.append(i + 1)
		x = y = 0
		a.append(n + 1)
		for i in a:
			y = max(i - x, y)
			x = i
		print(y)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			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')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


from sys import *
for _ in range(int(stdin.readline())):
	s = stdin.readline()
	l = []
	k = -1
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i - k)
			k = i
	l.append(len(s) - k - 1)
	print(max(l))


test_count = int(input())
for i in range(test_count):
	line = input()
	rPoses = [-1]
	for j in range(len(line)):
		if line[j] == 'R':
			rPoses.append(j)
	rPoses.append(len(line))
	diffs = []
	last = rPoses[0]
	for j in range(1, len(rPoses)):
		diffs.append(rPoses[j] - last)
		last = rPoses[j]
	print(max(diffs))


n = int(input())
for i in range(n):
	l = list(map(len, input().split('R')))
	print(max(l) + 1)


for _ in range(int(input())):
	s = input()
	(ans, tempL) = (0, 0)
	for c in s:
		if c == 'L':
			tempL += 1
		else:
			ans = max(ans, tempL)
			tempL = 0
	print(max(ans, tempL) + 1)


t = int(input())
while t:
	s = input()
	cur = 0
	tot = 0
	for i in range(0, len(s)):
		if s[i] == 'R':
			if cur > tot:
				tot = cur
			cur = 0
		else:
			cur += 1
			if cur > tot:
				tot = cur
	print(tot + 1)
	t -= 1


for _ in range(int(input())):
	s = list(input())
	r = -1
	m = 0
	l = len(s)
	for i in range(l):
		if s[i] == 'R':
			m = max(m, i - r)
			r = i
	m = max(m, l - r)
	print(m)


t = int(input())
while t:
	t -= 1
	a = input()
	n = len(a)
	inds = [-1]
	for i in range(n):
		if a[i] == 'R':
			inds.append(i)
	inds.append(n)
	ans = 0
	for i in range(1, len(inds)):
		ans = max(ans, inds[i] - inds[i - 1])
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	l = False
	first_l = -1
	d = 1
	for i in range(len(s)):
		if s[i] == 'L':
			if first_l == -1:
				first_l = i
				l = True
		elif l:
			d = max(i - first_l + 1, d)
			l = False
			first_l = -1
	if first_l > -1:
		d = max(len(s) - first_l + 1, d)
	print(d)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	arr = list(sys.stdin.readline().rstrip())
	rcnt = arr.count('R')
	if rcnt == 0:
		print(len(arr) + 1)
		continue
	before = -1
	term = -1
	for i in range(len(arr)):
		if arr[i] == 'R':
			term = max(term, i - before)
			before = i
	term = max(term, len(arr) - before)
	print(term)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

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

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

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

def ntl(n):
	return [int(i) for i in str(n)]

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

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

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

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

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		s = si()
		n = len(s)
		x = [0]
		for i in range(n):
			if s[i] == 'R':
				x.append(i + 1)
		x.append(n + 1)
		ans = 0
		for i in range(len(x) - 1):
			ans = max(ans, x[i + 1] - x[i])
		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')

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))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


k = int(input())
for i in range(k):
	s = 'R' + input() + 'R'
	m = 0
	(x, y) = (0, 0)
	for p in range(len(s)):
		if s[p] == 'R':
			(x, y) = (y, p)
			if y - x > m:
				m = y - x
	print(m)


for t in range(int(input())):
	arr = list(input())
	if arr.count('R') == 0:
		print(len(arr) + 1)
	elif arr.count('R') == len(arr):
		print(1)
	else:
		pos = [0, len(arr) + 1]
		for i in range(len(arr)):
			ele = arr[i]
			if ele == 'R':
				pos.append(i + 1)
			else:
				continue
		pos.sort()
		maxim = 0
		for i in range(1, len(pos)):
			diff = pos[i] - pos[i - 1]
			maxim = max(maxim, diff)
		print(maxim)


t = int(input())
for i in range(t):
	s = input()
	s = 'R' + s + 'R'
	l = len(s)
	a = [0]
	for j in range(l):
		if s[j] == 'L':
			continue
		for k in range(j + 1, l):
			if s[k] == 'R':
				a.append(k - j)
				break
	ans = max(a)
	print(ans)


for _ in range(int(input())):
	s = input() + 'R'
	r_p = -1
	m = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if i - r_p > m:
				m = i - r_p
			r_p = i
	print(m)


t = int(input())
for _ in range(t):
	s = input()
	curr = 0
	res = 0
	for i in range(len(s)):
		if s[i] == 'L':
			curr += 1
		if s[i] == 'R':
			res = max(res, curr)
			curr = 0
	res = max(res, curr)
	print(res + 1)


t = int(input())
for k in range(t):
	s = input()
	prev = -1
	best_d = -1
	for i in range(len(s)):
		if s[i] == 'R':
			best_d = max(best_d, i - prev)
			prev = i
	if best_d == -1:
		best_d = len(s) + 1
	else:
		best_d = max(best_d, len(s) - prev)
	print(best_d)


T = int(input())
ans = ''
for _ in range(T):
	s = input()
	k = 1
	t = 1
	for i in range(len(s)):
		if s[i] == 'L':
			t += 1
		else:
			k = max(k, t)
			t = 1
	ans += str(max(k, t)) + '\n'
print(ans)


p = int(input())
for q in range(p):
	entrada = input()
	sub = ''
	cont = 0
	maior = 0
	for k in range(len(entrada)):
		if entrada[k] == 'L':
			cont += 1
		else:
			if cont > maior:
				maior = cont
			cont = 0
	if cont > maior:
		maior = cont
	print(maior + 1)


t = int(input())
for _ in range(t):
	s = str(input())
	l = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	p = []
	for j in range(len(l) - 1):
		p.append(l[j + 1] - l[j])
	print(max(p))


from sys import stdin

def inp():
	return (ss.rstrip() for ss in stdin).__next__()

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	s = 'R' + inp() + 'R'
	last = 0
	ans = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			last = i
		ans = max(ans, i - last)
	print(ans + 1)


for t in range(int(input())):
	s = input()
	n = len(s)
	cnt = 0
	res = 0
	for i in range(n):
		if s[i] == 'L':
			cnt += 1
		else:
			res = max(cnt, res)
			cnt = 0
	res = max(cnt, res)
	print(res + 1)


t = int(input())
for l in range(t):
	a = input()
	i = 1
	num = []
	c = 0
	for k in a:
		if k == 'R':
			num.append(i - c)
			c = i
		i += 1
	num.append(i - c)
	print(max(num))


for _ in range(int(input())):
	kq = 0
	s = 'R' + input() + 'R'
	i = 0
	n = len(s) - 2
	while i <= n:
		if s[i] == 'R':
			i += 1
			continue
		dem = 1
		while s[i] == 'L' and s[i + 1] == 'L':
			i += 1
			dem += 1
		kq = max(kq, dem)
		i += 1
	print(kq + 1)


from sys import stdin, stdout
from collections import deque, defaultdict
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def can_reach(s, d):
	(seen, M, m) = (set(), float('-inf'), float('inf'))
	Q = deque([-1])
	while Q:
		curr = Q.pop()
		if curr in seen:
			continue
		seen.add(curr)
		if curr == -1 or s[curr] == 'R':
			if curr + d >= len(s):
				return True
			for j in range(max(M, curr + 1), min(len(s), curr + d + 1)):
				if j not in seen:
					Q.appendleft(j)
			M = max(M, curr + d)
		else:
			for j in range(max(0, curr - d), min(curr, m)):
				if j not in seen:
					Q.appendleft(j)
			m = min(m, curr - d)
	return False

def main():
	T = int(rl())
	for _ in range(T):
		s = rll()[0]
		n = len(s)
		(d, jump) = (n + 1, n + 1)
		while jump >= 1:
			while d - jump >= 1 and can_reach(s, d - jump):
				d -= jump
			jump //= 2
		stdout.write(str(d))
		stdout.write('\n')
	stdout.close()
main()


T = int(input().strip())
for t in range(T):
	S = str(input().strip())
	maxL = 0
	currL = 0
	for s in S:
		if s == 'L':
			currL += 1
		else:
			if currL > maxL:
				maxL = currL
			currL = 0
	if currL > maxL:
		maxL = currL
	print(maxL + 1)


N = int(input())
for i in range(N):
	s = input()
	countL = 0
	max = 0
	for j in range(len(s)):
		if s[j] == 'L':
			countL = countL + 1
			if countL > max:
				max = countL
		else:
			countL = 0
	print(max + 1)


t = int(input())

def find_greater_distance(way):
	i = -1
	distance = 0
	for j in range(len(way)):
		if way[j] == 'R':
			if j - i > distance:
				distance = j - i
			i = j
	return len(way) - i if len(way) - i > distance else distance
for _ in range(t):
	s = input()
	print(find_greater_distance(s))


t = int(input())

def find(a):
	for i in range(len(a)):
		if a[i] == 1:
			return i + 1
	return len(a) + 1
for i in range(t):
	s = str(input())
	a = []
	for i in s:
		if i == 'L':
			a.append(0)
		else:
			a.append(1)
	n = len(a)
	m = -1
	ans = []
	for j in range(n):
		if a[j] == 1:
			ans.append(j - m)
			m = j
	ans.append(n - m)
	print(max(ans))


T = int(input())
for i in range(T):
	s = input()
	l = [0] * len(s)
	d = -1
	g = 1
	m = 0
	c = 0
	for j in range(len(s)):
		if s[j] == 'L':
			c = c + 1
		else:
			if m < c:
				m = c
			c = 0
	if c != 0:
		if c > m:
			m = c
	print(m + 1)


t = int(input())
for _ in range(t):
	s = str(input())
	d = 0
	last = 0
	for i in range(len(s)):
		if s[i] == 'R':
			d = max(i + 1 - last, d)
			last = i + 1
	print(max(d, len(s) + 1 - last))


for _ in range(int(input())):
	s = input()
	ans = s.find('R')
	if ans == -1:
		print(len(s) + 1)
	else:
		ans += 1
		first = ans - 1
		temp = ans
		for i in range(temp, len(s)):
			if s[i] == 'R':
				ans = max(ans, i - first)
				first = i
		ans = max(ans, len(s) - first)
		print(ans)


from itertools import groupby
for _ in range(int(input())):
	s = input()
	l = [(k, len(list(v))) for (k, v) in groupby(s)]
	if len(l) == 1 and l[0][0] == 'R' or not len(l):
		print(1)
	else:
		print(max((__ for (_, __) in l if _ == 'L')) + 1)


t = int(input())
for i in range(t):
	s = input()
	m = 0
	j = 0
	m1 = 0
	while j < len(s):
		if s[j] == 'L':
			m1 += 1
		else:
			m = max(m1, m)
			m1 = 0
		j += 1
	m = max(m1, m)
	print(m + 1)


x = int(input())
while x:
	x -= 1
	s = input()
	a = s.split('R')
	print(len(max(a)) + 1)


a = int(input())
for i in range(a):
	s = input()
	ans = [-1]
	for i in range(len(s)):
		if s[i] == 'R':
			ans.append(i)
	gam = []
	for i in range(1, len(ans)):
		gam.append(ans[i] - ans[i - 1])
	gam.append(len(s) - ans[-1])
	if len(gam) == 0:
		print(len(s) + 1)
	else:
		print(max(gam))


def main():
	t = int(input())
	for __ in range(t):
		s = input()
		n = len(s)
		r = []
		found = False
		for i in range(n):
			if s[i] == 'R':
				r.append(i + 1)
				found = True
		if found:
			d = r[0]
			j = r[0]
			m = len(r)
			for i in range(1, m):
				if j + d < r[i]:
					d += r[i] - (j + d)
					j = r[i]
				else:
					j = r[i]
			if j + d < n + 1:
				d += n + 1 - (j + d)
			print(d)
		else:
			print(n + 1)
main()


t = int(input())
for _ in range(t):
	l = list(input())
	an = 0
	i = 0
	while i < len(l):
		if l[i] == 'L':
			j = i
			while i != len(l) - 1 and l[i + 1] == 'L':
				i += 1
			an = max(i + 1 - j, an)
		i += 1
	print(an + 1)


n = int(input())
while n > 0:
	a = input()
	l = []
	x = 0
	l.append(0)
	for i in range(len(a)):
		if a[i] == 'R':
			l.append(i + 1)
	l.append(len(a) + 1)
	for j in range(1, len(l)):
		d = l[j] - l[j - 1]
		if d > x:
			x = d
	print(x)
	n = n - 1


def fun(s):
	cnt = 0
	a = []
	for i in range(len(s)):
		cnt += 1
		if s[i] == 'R':
			a.append(cnt)
			cnt = 0
	a.append(cnt + 1)
	print(max(a))
t = int(input())
for _ in range(t):
	s = input()
	fun(s)


for t in range(int(input())):
	s = list(map(str, input()))
	l = ['R']
	l = l + s
	l.append('R')
	k = []
	n = 0
	for i in range(len(l)):
		if l[i] == 'R':
			k.append(i)
	for j in range(len(k) - 1):
		if k[j + 1] - k[j] > n:
			n = k[j + 1] - k[j]
	print(n)


def solution(frase):
	inicio = 0
	fim = len(frase) + 1
	meio = int((inicio + fim) / 2)
	candidate = 0
	while inicio <= fim and fim:
		if chega(frase, meio):
			fim = meio - 1
			candidate = meio
		else:
			inicio = meio + 1
		meio = meio = int((inicio + fim) / 2)
	return candidate

def chega(frase, meio):
	frase = '-' + frase + ' '
	postion = 0
	tamanho = meio
	while frase[postion] != ' ' and tamanho > 0:
		if postion + tamanho > len(frase) - 1:
			tamanho -= 1
		elif frase[postion + tamanho] == 'R' or frase[postion + tamanho] == ' ':
			postion += tamanho
			tamanho = meio
		else:
			tamanho -= 1
	if frase[postion] == ' ':
		return True
	else:
		return False
n_casos = int(input())
casos = []
for i in range(n_casos):
	casos.append(input())
for caso in casos:
	print(solution(caso))


t = int(input())
for i in range(t):
	string = input()
	counter = 0
	k = 0
	for j in range(0, len(string)):
		if string[j] == 'L':
			counter = counter + 1
		if counter > k:
			k = counter
		if string[j] == 'R':
			counter = 0
	print(k + 1)


def frog(string):
	l = len(string)
	if 'R' not in string:
		return l + 1
	else:
		s = 0
		last_r = 0
		for (i, x) in enumerate(string):
			if x == 'R':
				new_s = i + 1 - last_r
				last_r = i + 1
				if new_s > s:
					s = new_s
		if l - last_r + 1 > s:
			s = l - last_r + 1
		return s
t = int(input())
array = []
for i in range(t):
	array.append(input())
for x in array:
	print(frog(x))


import sys
from collections import Counter

def main():
	for _ in range(int(sys.stdin.readline())):
		n = sys.stdin.readline()
		n = list(n)
		n.pop()
		n.append('R')
		n.insert(0, 'R')
		x = len(n)
		l = []
		for i in range(x):
			if n[i] == 'R':
				l.append(i)
		if len(l) == 2:
			print(x - 1)
		else:
			ans = -1
			for i in range(len(l) - 1):
				x = l[i + 1] - l[i]
				if x > ans:
					ans = x
			print(ans)
main()


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

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

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

def inpln(n):
	return list((int(sys.stdin.readline()) for i in range(n)))
T = inp()
for _ in range(T):
	a = input()
	res = 0
	cnt = 0
	for (i, t) in enumerate(a):
		if t == 'L':
			cnt += 1
			res = max(cnt, res)
		else:
			cnt = 0
	print(res + 1)


I = input
pr = print
ar = []
exec(int(I()) * 'ar.append(I());')
for x in ar:
	m = t = 0
	for y in x:
		if y == 'L':
			t += 1
		else:
			m = max(m, t)
			t = 0
		m = max(m, t)
	print(m + 1)


t = int(input())
for _ in range(t):
	s = list(input())
	ma = 0
	count = 0
	for i in s:
		if i == 'L':
			count += 1
		else:
			if count > ma:
				ma = count
			count = 0
	if count > ma:
		ma = count
	print(ma + 1)


t = int(input())
res = []
for z in range(t):
	s = input()
	s = 'R' + s + 'R'
	res.append(0)
	for i in range(len(s) - 1):
		if s[i] == 'R':
			j = i + 1
			while s[j] != 'R':
				j += 1
			if res[z] < j - i:
				res[z] = j - i
for i in range(t):
	print(res[i])


testes = int(input())
respostas = []
for _ in range(testes):
	respostas.append(len(sorted(input().split('R'), reverse=True)[0]) + 1)
for resp in respostas:
	print(resp)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	ans = 1
	anstmp = 1
	for i in range(n):
		if s[i] == 'R':
			ans = max(anstmp, ans)
			anstmp = 1
		else:
			anstmp += 1
	ans = max(anstmp, ans)
	print(ans)


T = int(input())
for t in range(T):
	s = input()
	s = 'R' + s + 'R'
	maxd = 0
	last = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			if i - last > maxd:
				maxd = i - last
			last = i
	print(maxd)


for nt in range(int(input())):
	s = 'R' + input() + 'R'
	gap = 0
	prev = 'R'
	count = 0
	for i in range(1, len(s)):
		if s[i] == 'L' and prev == 'R':
			count = 1
			prev = 'L'
		elif s[i] == 'L':
			count += 1
		else:
			if count > gap:
				gap = count
			count = 0
	print(gap + 1)


R = lambda : map(int, input().split())
from collections import defaultdict
t = int(input())

def solve(a):
	count = 0
	longest = 0
	for i in range(len(a)):
		if a[i] == 'L':
			count += 1
		if i == len(a) - 1 or a[i] == 'R':
			longest = max(longest, count)
			count = 0
	return longest + 1
for _ in range(t):
	a = input()
	print(solve(a))


def min_jump_limit(directions):
	max_left_count = 0
	left_count = 0
	for direction in directions:
		if direction == 'R':
			left_count = 0
			continue
		if direction == 'L':
			left_count += 1
			max_left_count = max(max_left_count, left_count)
			continue
		raise Exception('invalid direction')
	return max_left_count + 1
number_of_tests = int(input())
for _ in range(number_of_tests):
	directions = input()
	result = min_jump_limit(directions)
	print(result)


from fractions import Fraction
from collections import defaultdict
import math
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')
t = int(input())
for _ in range(t):
	s = input()
	r = []
	r.append(0)
	n = len(s)
	for i in range(n):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(n + 1)
	min = 0
	for j in range(1, len(r)):
		min = max(min, r[j] - r[j - 1])
	print(min)


from sys import stdin
try:
	for _ in range(int(stdin.readline())):
		s = stdin.readline().rstrip()
		arr = [0 if ele == 'R' else 1 for ele in s]
		(n, ind, d) = (len(s), 0, 0)
		if 0 in arr:
			ind = arr.index(0)
			d = ind + 1
		if 0 not in arr:
			print(n + 1)
		elif sum(arr[ind:]) == 0:
			print(d)
		else:
			(l, count) = ([], 0)
			arr.append(0)
			for ele in arr:
				if ele == 0:
					l += [count]
					count = 0
				else:
					count += 1
			print(max(l) + 1)
except:
	pass


for _ in range(int(input())):
	s = input()
	KK = s.split('R')
	l = list(map(len, KK))
	m = 0
	for i in l:
		if i > m:
			m = i
	print(m + 1)


n = int(input())
for p in range(n):
	s = 'R' + input() + 'R'
	(m, I) = (0, 0)
	for i in range(1, len(s)):
		if s[i] == 'R':
			m = max(i - I, m)
			I = i
	print(m)


for _ in range(int(input())):
	s = input()
	n = 1
	m = 0
	for i in range(len(s)):
		if s[i] != 'R':
			n += 1
		else:
			n = 1
		if n > m:
			m = n
	print(m)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	s = input()
	ans = 0
	lens = len(s)
	i = 0
	while i < len(s):
		t = 0
		while i < lens and s[i] == 'L':
			t += 1
			i += 1
		ans = max(ans, t)
		i += 1
	print(max(1, ans + 1))


def solve():
	s = input()
	n = len(s)
	ans = 0
	m = 0
	t = s[0]
	if t == 'L':
		m = 1
		ans = 1
	for i in range(1, n):
		if s[i] == 'L':
			m += 1
			ans = max(ans, m)
		else:
			m = 0
	return ans + 1
for _ in range(int(input())):
	print(solve())


t = int(input())
for _ in range(t):
	s = input()
	s = 'R' + s + 'R'
	ma = 0
	co = 0
	for i in s:
		if i == 'R':
			co = 0
		else:
			co += 1
		ma = max(co, ma)
	print(ma + 1)


def check_l(string):
	output = 0
	con = 0
	for i in range(len(string)):
		if con > 0:
			con -= 1
			continue
		if string[i] == 'L':
			maximum = 1
			for j in range(i + 1, len(string)):
				if string[j] == 'L':
					maximum += 1
					con += 1
				else:
					break
			if maximum > output:
				output = maximum
	if output == 0:
		return output + 1
	return output + 1

def frog_jumps():
	cases = int(input())
	strings = []
	for i in range(cases):
		strings.append(input())
	for i in range(len(strings)):
		jump = check_l(strings[i])
		print(jump)
frog_jumps()


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(input().rstrip()) for _ in range(Q)]
for S in Query:
	tmp = 0
	ans = 0
	for (i, s) in enumerate(S):
		if s == 'L':
			tmp += 1
		else:
			ans = max(tmp + 1, ans)
			tmp = 0
	ans = max(tmp + 1, ans)
	print(ans)


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
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 RL():
	return map(int, sys.stdin.readline().rstrip().split())

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

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		arr = list(input())
		rec = [0]
		res = 0
		for (i, v) in enumerate(arr):
			if v == 'R':
				res = max(i + 1 - rec[-1], res)
				rec.append(i + 1)
		res = max(res, len(arr) + 1 - rec[-1])
		print(res)
main()


import math
from decimal import *
for _ in range(int(input())):
	s = str(input())
	s = '0' + s
	ans = 0
	(p1, p2) = (0, len(s))
	for i in range(1, len(s)):
		if s[i] == 'R':
			p2 = int(i)
			ans = max(ans, p2 - p1)
			p1 = int(i)
	if ans == 0:
		ans = len(s)
	else:
		ans = max(len(s) - p1, ans)
	print(ans)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input().strip()
	a = [0] + [i + 1 for i in range(len(s)) if s[i] == 'R'] + [len(s) + 1]
	b = [a[i] - a[i - 1] for i in range(1, len(a))]
	print(max(b))


import math

def solve():
	data = [char for char in input()]
	d = 1
	tile = len(data) - 1
	count = 1
	while tile >= 0:
		if data[tile] == 'L':
			tile -= 1
			count += 1
		else:
			if count > d:
				d = count
			tile -= 1
			count = 1
	if count > d:
		d = count
	print(d)
t = int(input())
for i in range(t):
	solve()


def main():
	d = int(input())
	for i in range(d):
		s = input()
		l = 0
		res = []
		for (i, v) in enumerate(s):
			if v == 'R':
				res.append(i + 1 - l)
				l = i + 1
		res.append(len(s) + 1 - l)
		print(max(res) if res else len(s) + 1)
main()


for _ in range(int(input())):
	w = input()
	n = len(w)
	if 'R' not in w:
		print(n + 1)
	else:
		mp = [0]
		for i in range(n):
			if w[i] == 'R':
				mp.append(i + 1)
		mp.append(n + 1)
		ans = []
		aaaa = -10 ** 9
		for i in range(len(mp) - 1):
			t = mp[i + 1] - mp[i]
			aaaa = max(aaaa, t)
		print(aaaa)


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	ind = [-1]
	d = []
	co = s.count('R')
	if co is 0:
		print(n + 1)
	else:
		loc = 0
		for j in range(n):
			if s[j] == 'R':
				ind.append(j)
		ind.append(n)
		for j in range(len(ind) - 1):
			diff = ind[j + 1] - ind[j]
			d.append(diff)
		print(max(d))


t = int(input())
while t:
	t -= 1
	ans = 0
	s = list(input())
	is_prev_L = False
	cur_L_count = 0
	for i in s:
		if i == 'L':
			cur_L_count += 1
		else:
			if cur_L_count > ans:
				ans = cur_L_count
			cur_L_count = 0
	if cur_L_count > ans:
		ans = cur_L_count
	print(ans + 1)


T = int(input())
while T:
	s = input()
	loc = -1
	m = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if i - loc > m:
				m = i - loc
			loc = i
	if loc == -1:
		print(len(s) + 1)
	else:
		if len(s) - loc > m:
			m = len(s) - loc
		print(m)
	T -= 1


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

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

def mi():
	return map(int, input().split())
for _ in range(ii()):
	path = list(input())
	arr = [0 for i in range(len(path) + 1)]
	max_con_seq = 0
	temp = 0
	cont = False
	for ele in path:
		if ele == 'L' and cont:
			temp += 1
		elif ele == 'R':
			cont = False
			max_con_seq = max(max_con_seq, temp)
			temp = 0
		else:
			cont = True
			temp += 1
	print(max(max_con_seq, temp) + 1)


for _ in range(int(input())):
	l = list(input())
	d = 0
	index = len(l)
	flag = 0
	for i in range(len(l) - 1, -1, -1):
		if i < index - d:
			if l[i] == 'R':
				d = index - i
				index = i
		elif l[i] == 'R':
			index = i
	if 0 < index - d + 1:
		d = index - i + 1
	print(d)


from sys import stdin, stdout
n = int(stdin.readline())
a = []
for i in range(n):
	a.append(stdin.readline())
for k in range(n):
	counter = 0
	ans = 0
	for j in range(len(a[k])):
		if a[k][j] == 'L':
			counter += 1
		else:
			ans = max(ans, counter + 1)
			counter = 0
	print(ans)


from sys import exit

def i():
	return input()

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

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

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

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	bla = []
	s = input()
	last = 'R'
	count = 0
	for i in range(len(s)):
		if s[i] == 'L' and last == s[i]:
			count += 1
		elif s[i] == 'L':
			count = 1
		else:
			bla.append(count)
			count = 0
		last = s[i]
	bla.append(count)
	print(max(bla) + 1)


def solve(s):
	s = 'R' + s + 'R'
	cur = 0
	ret = -1
	for (i, v) in enumerate(s):
		if v == 'R':
			ret = max(ret, i - cur)
			cur = i
	return ret

def main():
	inp = lambda : [int(x) for x in input().split()]
	i = lambda : int(input())
	tc = i()
	for _ in range(tc):
		s = input()
		print(solve(s))
main()


t = int(input())
for i in range(t):
	n = input()
	if 'R' in n:
		s = n.split('R')
		length = map(len, s)
		print(max(*length) + 1)
	else:
		print(len(n) + 1)


import sys

def solve():
	s = input()
	n = len(s)
	str = [s[i] for i in range(n)]
	str.append('R')
	mx = 0
	prev = -1
	for i in range(n + 1):
		if str[i] == 'R':
			mx = max(mx, i - prev)
			prev = i
	return mx
t = int(input())
while t > 0:
	print(solve())
	t -= 1


t = int(input())
result = []
for _ in range(t):
	s = 'R' + input() + 'R'
	A = []
	for i in range(len(s)):
		if s[i] == 'R':
			A.append(i)
	B = []
	for i in range(1, len(A)):
		B.append(A[i] - A[i - 1])
	result.append(str(max(B)))
print('\n'.join(result))


for _ in range(int(input())):
	s = input()
	m = 0
	i = 0
	n = len(s)
	while i < n:
		if s[i] == 'L':
			counter = 0
			while i < n and s[i] == 'L':
				counter += 1
				i += 1
			if m < counter:
				m = counter
		i += 1
	print(m + 1)


import sys
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
for _ in range(get_int()):
	s = 'R' + get_string() + 'R'
	mx = 0
	count = 0
	Istart = 0
	Iend = 1
	while Iend < len(s):
		if s[Iend] == 'R':
			mx = max(mx, count)
			count = 0
			Istart = Iend
			Iend += 1
		else:
			count += 1
			Iend += 1
	print(mx + 1)


t = int(input())
for _ in range(t):
	s = input()
	champ = []
	cnt = 1
	for i in s:
		if i == 'R':
			champ.append(cnt)
			cnt = 1
		else:
			cnt += 1
	champ.append(cnt)
	print(max(champ))


def main():
	op = ''
	t = int(input())
	for i in range(t):
		ip = input()
		j = 0
		prev_r = 0
		max_dist = 0
		r_cnt = 0
		while j < len(ip):
			if ip[j] == 'R':
				if r_cnt != 0:
					max_dist = max(max_dist, j - prev_r)
				else:
					max_dist = j + 1
					r_cnt += 1
				prev_r = j
			j += 1
		if max_dist != 0:
			max_dist = max(max_dist, len(ip) - prev_r)
			op += str(max_dist) + '\n'
		else:
			op += str(len(ip) + 1) + '\n'
	print(op)
main()


for _ in range(int(input())):
	s = input()
	max_len = 0
	cnt = 0
	for i in range(len(s)):
		if s[i] == 'L':
			cnt += 1
		elif s[i] == 'R':
			if cnt > max_len:
				max_len = cnt
			cnt = 0
	if i == len(s) - 1 and cnt > max_len:
		max_len = cnt
	print(max_len + 1)


t = int(input())
for z in range(t):
	s = input()
	last = -1
	jump = 1
	flag = 0
	for i in range(len(s)):
		if s[i] == 'R':
			flag = 1
			if last == -1:
				jump = i + 1
			elif jump < i - last:
				jump = i - last
			last = i
	if flag == 0:
		print(len(s) + 1)
	elif last + jump < len(s):
		print(len(s) - last)
	else:
		print(jump)


t = int(input())
for x in range(0, t):
	s = input()
	s = list(s)
	n = len(s)
	ans = 0
	cnt = 0
	for i in range(0, n):
		if s[i] == 'L':
			cnt = cnt + 1
		else:
			if ans < cnt:
				ans = cnt
			cnt = 0
	if ans < cnt:
		ans = cnt
	print(ans + 1)


t = int(input())
for i in range(t):
	IN = input()
	crt = 0
	ms = 0
	for x in IN:
		if x == 'L':
			crt += 1
		else:
			if crt > ms:
				ms = crt
			crt = 0
	if crt > ms:
		ms = crt
	print(ms + 1)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

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

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

def Lstr():
	return list(sys.stdin.readline().strip())

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

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

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

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

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for _ in range(Int()):
		s = Str()
		p = 0
		c = 0
		res = []
		for i in range(len(s)):
			if s[i] == 'R':
				res.append(i + 1)
		res.insert(0, 0)
		res.append(len(s) + 1)
		ans = 0
		for i in range(len(res) - 1):
			ans = max(ans, res[i + 1] - res[i])
		print(ans)
solution()


for _ in range(int(input())):
	s = input()
	n = 0
	c = 0
	f = 0
	for i in range(len(s)):
		if s[i] == 'L' and f == 0:
			f = 1
			c = 1
		elif s[i] == 'L' and f == 1:
			c += 1
		else:
			f = 0
			if c > n:
				n = c
	if c > n:
		n = c
	print(n + 1)


for _ in range(int(input())):
	s = str(input())
	count = 0
	m = 0
	for i in s:
		if i == 'L':
			count += 1
		else:
			m = max(count, m)
			count = 0
	m = max(count, m)
	if m == 0:
		print(1)
	else:
		print(m + 1)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

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

def oint():
	return int(input())
t = oint()
for _ in range(t):
	s = str(get_str())
	ss = s.replace('R', ' ').split()
	max_len = 0
	for ll in ss:
		if len(ll) > max_len:
			max_len = len(ll)
	print(max_len + 1)


for _ in range(int(input())):
	s = sorted([len(x) for x in input().split('R')], reverse=True)
	print(s[0] + 1)


t = int(input())
for test in range(t):
	x = input()
	y = list(x)
	z = []
	for i in range(len(y)):
		if y[i] == 'R':
			z.append(i)
	if len(z) > 0:
		if len(z) == 1:
			p = z[0]
			q = len(y) - z[0] - 1
			if p >= q:
				max = p
			else:
				max = q
			print(max + 1)
		else:
			a = []
			for i in range(1, len(z)):
				a.append(z[i] - (z[i - 1] + 1))
			a.append(len(y) - z[len(z) - 1] - 1)
			a.append(z[0])
			m = a[0]
			for i in range(len(a)):
				if a[i] > m:
					m = a[i]
			print(m + 1)
	else:
		print(len(y) + 1)


a = int(input())
r = 0
f = list()
while r < a:
	b = [char for char in input()]
	blen = len(b)
	(s, m) = (0, 0)
	(e, d, c) = (0, 0, 0)
	while s < blen:
		if b[s] == 'R':
			c = s + 1
			e = c - m
			b[s] = 'A'
			if e > d:
				d = e
			m = c
		s = s + 1
	e = blen + 1 - m
	if e > d:
		d = e
	f.append(d)
	r = r + 1
r = 0
while r < a:
	print(f[r])
	r = r + 1


tests = int(input())
for _ in range(tests):
	m = 0
	c = 1
	s = 'R' + input() + 'R'
	for d in s:
		if d == 'R':
			m = max(m, c)
			c = 1
		else:
			c += 1
	print(m)


import sys
import math
for _ in range(int(input())):
	s = list(input())
	s.insert(0, 'R')
	s.append('R')
	m = -1
	prev = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			dist = i - prev
			if dist > m:
				m = dist
			prev = i
	print(m)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

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

def invr():
	return map(int, input().split())
test = inp()
for k in range(test):
	s = insr()
	n = len(s)
	(left, right) = (0, 0)
	maxL = 0
	temp = 0
	while right < n:
		if s[right] == 'R':
			maxL = max(maxL, temp)
			left = right + 1
			temp = 0
		else:
			temp += 1
		right += 1
	maxL = max(maxL, temp)
	print(maxL + 1)


t = int(input())
for i in range(t):
	s = input()
	if s.count('L') == 0:
		print(1)
	elif s.count('R') == 0:
		print(len(s) + 1)
	else:
		A = []
		for i in range(len(s)):
			if s[i] == 'R':
				A.append(i)
		X = []
		for i in range(len(A) - 1):
			X.append(A[i + 1] - A[i])
		if len(X) > 0:
			z = max(X)
		else:
			z = 0
		x = s.index('R') + 1
		s = s[::-1]
		y = s.index('R') + 1
		print(max(max(x, y), z))


t = int(input())
out = []
for i in range(t):
	maxL = 1
	currentL = 1
	seq = input()
	for j in range(len(seq)):
		c = seq[j]
		if c == 'L':
			currentL += 1
		else:
			if currentL > maxL:
				maxL = currentL
			currentL = 1
	out.append(str(max(maxL, currentL)))
print('\n'.join(out))


from sys import stdin
N = int(stdin.readline().rstrip())
ans = 0
for i in range(N):
	ans = 0
	S = 'R' + input() + 'R'
	dist = 0
	for i in range(0, len(S)):
		if S[i] == 'L':
			dist += 1
		else:
			dist = 0
		ans = max(ans, dist)
	print(ans + 1)


for _ in range(int(input())):
	s = input()
	n = len(s)
	ans = 0
	i = 0
	while i < n:
		j = i
		if s[j] == 'L':
			while j < n and s[j] == 'L':
				j += 1
		ans = max(ans, j - i)
		if i == j:
			i += 1
		else:
			i = j
	print(ans + 1)


for _ in range(int(input())):
	n = 'R' + input()
	l = []
	for i in range(len(n)):
		if n[i] == 'R':
			l.append(i)
	l.append(len(n))
	max = 0
	for i in range(1, len(l)):
		if l[i] - l[i - 1] > max:
			max = l[i] - l[i - 1]
	print(max)


for _ in range(int(input())):
	s = input()
	if s.count('R') == 0:
		print(len(s) + 1)
	elif s.count('L') == 0:
		print('1')
	else:
		count = 0
		maxi = 0
		for i in s:
			if i == 'L':
				count += 1
				maxi = max(count, maxi)
			else:
				count = 0
		print(maxi + 1)


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	s = read_line()
	a = s.split('R')
	cnt = 1
	if len(a) > 0:
		for i in range(len(a)):
			if len(a[i]) >= cnt:
				cnt = len(a[i]) + 1
	print(cnt)


t = int(input())
while t != 0:
	A = str(input())
	i = 0
	C = []
	while i < len(A):
		if A[i] == 'R':
			C.append(i + 1)
		i += 1
	if len(C) == 0:
		print(len(A) + 1)
	else:
		D = [C[0]]
		j = 0
		while j != len(C) - 1:
			D.append(C[j + 1] - C[j])
			j += 1
		D.append(len(A) + 1 - C[j])
		print(max(D))
	t -= 1


for _ in range(int(input())):
	seq = input()
	d = 0
	cnt = 1
	for ch in seq + 'R':
		if ch == 'R':
			d = max(d, cnt)
			cnt = 1
		else:
			cnt += 1
	print(d)


for _ in [0] * int(input()):
	a = [i for (i, x) in enumerate('R' + input() + 'R') if x > 'L']
	print(max((y - x for (x, y) in zip(a, a[1:]))))


for _ in range(int(input())):
	s = input()
	c = 1
	m = 1
	for x in s:
		if x == 'L':
			c += 1
		else:
			if c > m:
				m = c
			c = 1
	if c > m:
		m = c
	print(m)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict
import bisect
import heapq as hq

def main():
	try:
		for _ in range(int(input())):
			l = ['R']
			l.extend(list(input()))
			l.append('R')
			ans = []
			mi = 0
			for x in range(len(l)):
				if l[x] == 'R':
					ans.append(x - mi)
					mi = x
			print(max(ans))
	except:
		pass
M = 998244353
P = 1000000007
main()


def main():
	s = input()
	s = 'R' + s + 'R'
	(ans, run) = (0, 0)
	for i in range(len(s)):
		if s[i] == 'L':
			run += 1
		else:
			ans = max(ans, run)
			run = 0
	print(ans + 1)
for _ in range(int(input())):
	main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input().strip()
	flag = False
	biggest = 0
	count = 0
	for i in s:
		if i == 'L':
			count += 1
		else:
			if count > biggest:
				biggest = count
			count = 0
	if count > biggest:
		biggest = count
	print(biggest + 1)


for _ in range(int(input())):
	s = list(input())
	s.insert(0, 'R')
	maxr = -1
	pre = len(s)
	idx = pre - 1
	while idx != -1:
		if s[idx] == 'R':
			maxr = max(maxr, pre - idx)
			pre = idx
		idx -= 1
	print(maxr)


for _ in range(int(input())):
	s = input()
	if 'R' not in s:
		print(len(s) + 1)
		continue
	m = 0
	i = -1
	j = 0
	while j < len(s):
		if s[j] == 'R':
			if m < j - i:
				m = j - i
			i = j
		j += 1
	if j - i > m:
		m = j - i
	print(m)


t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	ans = []
	for i in range(len(s)):
		if s[i] == 'R':
			ans.append(i + 1)
	if len(ans) == 0:
		print(len(s) + 1)
	else:
		fina = []
		fina.append(ans[0] - 0)
		fina.append(n + 1 - ans[-1])
		for i in range(0, len(ans) - 1):
			fina.append(ans[i + 1] - ans[i])
		print(max(fina))


n = int(input())
for i in range(n):
	x = input()
	x += 'R'
	ans = 1
	z = 1
	for y in x:
		if y == 'L':
			z += 1
		if y == 'R':
			ans = max(z, ans)
			z = 1
	print(ans)


from sys import stdin, stdout
t = int(stdin.readline())
while t > 0:
	s = stdin.readline().split('\n')[0]
	n = len(s)
	(low, high) = (1, n + 1)
	ans = high
	while low <= high:
		mid = (low + high) // 2
		reach = mid
		valid = False
		i = 0
		while i < reach:
			if reach > n:
				valid = True
				break
			if s[i] == 'R':
				reach = i + mid + 1
			i += 1
		if valid:
			ans = mid
			high = mid - 1
		else:
			low = mid + 1
	stdout.write('{}\n'.format(ans))
	t -= 1


t = int(input())

def check(m):
	i = 0
	while i <= len(s):
		if s[i] == 'L':
			if i - d[i] <= m:
				i = d[i]
			else:
				return False
		elif abs(i - len(s)) <= m:
			return True
		elif dr.get(i, -1) != -1 and abs(dr[i] - i) <= m:
			i = dr[i]
		else:
			return False
	return True

def bs(s, l, h):
	if l <= h:
		m = (l + h) // 2
		if check(m):
			if m - 1 > 0 and check(m - 1):
				return bs(s, l, m - 1)
			else:
				return m
		else:
			return bs(s, m + 1, h)
for t1 in range(t):
	s = input()
	s = 'R' + s
	k = []
	d = {}
	for i in range(len(s)):
		if s[i] == 'R':
			k.append(i)
		elif s[i] == 'L':
			d[i] = k[-1]
	j = []
	dr = {}
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			if len(j) > 0:
				dr[i] = j[-1]
			j.append(i)
	z = bs(s, 1, len(s) + 1)
	print(z)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(s):
	n = len(s)
	r = s.count('R')
	s = 'R' + s + 'R'
	if r == 0:
		return n + 1
	else:
		maxx = 1
		curr = 0
		for i in range(1, len(s)):
			curr += 1
			maxx = max(maxx, curr)
			if s[i] == 'R':
				curr = 0
		return maxx
T = int(input())
for _ in range(T):
	s = input()
	print(solve(s))


t = int(input())
for i in range(t):
	li = list(input())
	d = 0
	prev = -1
	ans = 0
	ansf = 0
	while d != len(li):
		if li[d] == 'R':
			ans = d - prev
			prev = d
			if ans > ansf:
				ansf = ans
		if d == len(li) - 1:
			ans = d - prev + 1
			if ans > ansf:
				ansf = ans
		d = d + 1
	print(ansf)


from sys import stdin, stdout

def solver(s, d):
	n = len(s)
	rbl = [False for i in range(n + 1)]
	rbl[0] = True
	for i in range(n):
		if rbl[i] == False:
			break
		if s[i] == 'R':
			for j in range(i, min(n + 1, i + d + 1)):
				rbl[j] = True
		if s[i] == 'L':
			for j in range(max(0, i - d), i):
				rbl[j] = True
	if rbl[n] == True:
		return True
	else:
		return False
t = int(input())
for i in range(t):
	s = input()
	s = 'R' + s
	arr = []
	for i in range(len(s)):
		if s[i] == 'R':
			arr.append(i)
	arr.append(len(s))
	ans = 1
	for i in range(len(arr) - 1):
		ans = max(ans, arr[i + 1] - arr[i])
	print(ans)


import sys
from math import ceil, sqrt
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []
for _ in range(cin()):
	s = input()
	ct = 0
	mx = 0
	for i in range(len(s)):
		if s[i] == 'L':
			ct += 1
		else:
			mx = max(mx, ct)
			ct = 0
	mx = max(mx, ct)
	print(mx + 1)


t = int(input())
while t != 0:
	s = input()
	right = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			right.append(i + 1)
	right.append(len(s) + 1)
	maxi = 0
	for i in range(len(right) - 1):
		maxi = max(maxi, right[i + 1] - right[i])
	print(maxi)
	t -= 1


import sys
sys.setrecursionlimit(200000000)
tc = int(input())

def solve(path: str, min_jmp):
	rightmost_r = path[::-1].find('R')
	if rightmost_r == -1:
		return max(min_jmp, len(path) + 1)
	else:
		pos = len(path) - rightmost_r - 1
		jmp = rightmost_r + 1
		return solve(path[:pos], max(min_jmp, jmp))

def solve_non_recursive(path: str):
	r_list = [i + 1 for (i, _) in enumerate(path) if _ == 'R']
	r_list.insert(0, 0)
	r_list.append(len(path) + 1)
	min_jmp = 0
	for i in range(len(r_list) - 1):
		min_jmp = max(r_list[i + 1] - r_list[i], min_jmp)
	return min_jmp
for _ in range(tc):
	path = input()
	print(solve_non_recursive(path))


t = int(input())
for i in range(t):
	path = input()
	maxrep = 0
	rep = 0
	for i in path:
		if i == 'L':
			rep += 1
		else:
			if rep > maxrep:
				maxrep = rep
			rep = 0
	if rep > maxrep:
		maxrep = rep
	print(maxrep + 1)


for _ in range(int(input())):
	jumps = input()
	n = len(jumps)
	if not 'R' in jumps:
		print(n + 1)
		continue
	step = 0
	now = 0
	for i in range(n):
		if jumps[i] == 'R':
			step = max(step, i + 1 - now)
			now = i + 1
	print(max(step, n + 1 - now))


c = int(input())
for _ in range(0, c):
	inp = list(input())
	maxl = 0
	candidate = 0
	for k in inp:
		if k == 'L':
			candidate += 1
		elif k == 'R':
			if candidate > maxl:
				maxl = candidate
			candidate = 0
	if candidate > maxl:
		maxl = candidate
	print(maxl + 1)


t = int(input().strip())
from collections import defaultdict
import bisect
for _ in range(t):
	s = input().strip()
	ans = 1
	temp = 1
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			temp = 1
		else:
			temp += 1
		if temp > ans:
			ans = temp
	print(ans)


T = int(input())
for _ in range(T):
	seq = 'S' + str(input()) + 'F'
	(longest, c) = (0, 0)
	for i in seq:
		if i == 'L':
			c += 1
		else:
			if longest < c:
				longest = c
			c = 0
	print(longest + 1)


n = input()
p = []
for i in range(0, int(n)):
	l = input()
	p.append(l)
for i in range(0, len(p)):
	k = [0]
	v = []
	c = p[i]
	if 'R' not in c:
		print(len(c) + 1)
	elif c.count('R') == len(c):
		print(1)
	else:
		for j in range(0, len(c)):
			if c[j] == 'R':
				v.append(j + 1 - k[-1])
				k.append(j + 1)
		v.append(len(c) + 1 - k[-1])
		print(max(v))


import sys
for i in range(int(input())):
	s = input()
	last = 0
	first = sys.maxsize
	m = -sys.maxsize
	n = len(s)
	if s == 'L' * n:
		print(n + 1)
	elif s == 'R' * n:
		print(1)
	else:
		for i in range(n):
			if s[i] == 'R':
				first = min(i, first)
				m = max(m, i - last)
				last = i
		print(max(first + 1, m, n - last))


def main():

	def is_ok(mid, S):
		flag = True
		from collections import Counter
		cur = Counter(S[:mid])
		for i in range(len(S) - mid + 1):
			if mid <= cur['L']:
				flag = False
				break
			cur[S[i]] -= 1
			if i + mid < len(S):
				cur[S[i + mid]] += 1
		if flag:
			return True
		else:
			return False

	def binary_search_meguru(S):
		ng = 0
		ok = len(S) + 2
		while abs(ok - ng) > 1:
			mid = ng + (ok - ng) // 2
			if is_ok(mid, S):
				ok = mid
			else:
				ng = mid
		return ok
	Q = int(input())
	for query in range(Q):
		S = input()
		print(binary_search_meguru(S))
main()


t = int(input())
for z in range(t):
	d = input()
	start = -1
	m = 0
	for j in range(len(d)):
		if d[j] == 'R':
			m = max(m, j - start)
			start = j
	m = max(m, len(d) - start)
	print(m)


for _ in range(int(input())):
	i = input().split('R')
	d = 1
	for sub in i:
		l = len(sub)
		if l >= d:
			d = l + 1
	print(d)


for _ in range(int(input())):
	s = input()
	n = len(s)
	L = [0]
	for x in range(n):
		if s[x] == 'R':
			L.append(0)
		else:
			L[-1] += 1
	print(max(L) + 1)


import math
t = int(input())
while t > 0:
	t -= 1
	s = input()
	maxx = 0
	cnt = 0
	for i in s:
		if i == 'L':
			cnt += 1
			if cnt > maxx:
				maxx = cnt
		else:
			cnt = 0
	print(maxx + 1)


t = int(input())
z = 0
while z < t:
	a = str(input())
	b = 1
	tb = 1
	y = 1
	l = 0
	for i in a:
		if i == 'L':
			l += 1
	if l == 0:
		print('1')
	else:
		while y < len(a):
			if a[y] == a[y - 1] and a[y] == 'L':
				tb += 1
			else:
				if tb > b:
					b = tb
				tb = 1
			y += 1
		print(max(tb, b) + 1)
	z += 1


import sys
from collections import defaultdict
t = int(sys.stdin.readline())
for _ in range(t):
	s = sys.stdin.readline()[:-1]
	n = len(s)
	count = 0
	d = 0
	for i in range(n):
		d = max(d, count)
		if s[i] == 'L':
			count += 1
		else:
			count = 0
	d = max(d, count)
	print(d + 1)


import bisect, collections

def reachable(d, s):
	need = 0
	for i in range(len(s) - 1, -2, -1):
		need += 1
		if need > d:
			return False
		if i >= 0 and s[i] == 'R':
			need = 0
	return True

def solution(T):
	s = input().strip()
	(l, r) = (0, len(s) + 1)
	res = r
	while l <= r:
		mid = (l + r) // 2
		if reachable(mid, s):
			res = min(res, mid)
			r = mid - 1
		else:
			l = mid + 1
	print(res)

def main():
	T = int(input().strip())
	for _ in range(T):
		solution(T)
main()


for _ in range(int(input())):
	s = 'R' + input() + 'R'
	(ans, j) = (0, 0)
	for i in range(len(s)):
		if s[i] == 'R':
			if i - j > ans:
				ans = i - j
			j = i
	print(ans)


import sys
t = int(input())
for _ in range(t):
	a = 'R'
	a += input() + 'R'
	l = 0
	r = 1
	ans = 0
	while r < len(a):
		if a[r] == 'R':
			ans = max(ans, r - l)
			l = r
			r += 1
		else:
			r += 1
	print(ans)


q = int(input())
for i in range(q):
	s = list(input()) + ['R']
	ans = 0
	cur = 0
	for x in s:
		if x == 'L':
			cur += 1
		else:
			if ans < cur:
				ans = cur
			cur = 0
	print(ans + 1)


def jumpy_frog(string):
	n = len(string)
	min_jump = [0] * (n + 2)
	index = n + 1
	for i in range(n - 1, -1, -1):
		if string[i] == 'R':
			min_jump[index] = index - (i + 1)
			index = i + 1
	min_jump[index] = index
	return max(min_jump)
n = int(input())
for i in range(n):
	print(jumpy_frog(input()))


def main():
	t = int(input())
	for i in range(0, t):
		solve()

def solve():
	s = input()
	(maior, atual) = (0, 0)
	for i in s:
		if i == 'L':
			atual += 1
		else:
			maior = max(maior, atual)
			atual = 0
	print(max(maior, atual) + 1)
main()


t = int(input())
for _ in range(t):
	a = input()
	a += 'R'
	diff = []
	pi = -1
	for i in range(len(a)):
		if a[i] == 'R':
			temp = i - pi
			pi = i
			diff.append(temp)
	print(max(diff))


def compute(string):
	n = len(string)
	stack = []
	start = -1
	min_d = 0
	for i in range(n):
		if string[i] == 'R':
			stack.append(i)
			min_d = max(min_d, stack[-1] - start)
			start = stack[-1]
	if stack:
		min_d = max(min_d, n - stack[-1])
	else:
		min_d = n + 1
	return min_d
t = int(input())
for _ in range(t):
	string = str(input())
	print(compute(string))


T = int(input())
for _ in range(T):
	n = input()
	n = n + 'R'
	v = 0
	j = -1
	for i in range(len(n)):
		if n[i] == 'R':
			v = max(v, i - j)
			j = i
	print(v)


def fun(s):
	n = len(s)
	prev = -1
	last = n
	d = 1
	for i in range(len(s)):
		if s[i] == 'R':
			d = max(d, i - prev)
			prev = i
	return max(d, last - prev)
t = int(input())
while t:
	s = input()
	print(fun(s))
	t -= 1


for i in range(int(input())):
	s = input()
	a = []
	a.append(-1)
	for j in range(len(s)):
		if s[j] == 'R':
			a.append(j)
	a.append(len(s))
	print(max([y - x for (x, y) in zip(a[:-1], a[1:])]))


ii = int(input())
for kk in range(ii):
	a = list(input())
	k = 0
	maxi = 0
	for i in range(1, len(a)):
		if a[i] == 'L' and a[i - 1] == 'L':
			k += 1
		else:
			k = 0
		if k > maxi:
			maxi = k
	if maxi == 0 and 'L' in a:
		print(2)
	elif maxi == 0:
		print(1)
	else:
		print(maxi + 2)


t = int(input())
for i in range(t):
	s = input()
	if len(s) == 1:
		if s[0] == 'R':
			print(1)
			continue
		else:
			print(2)
			continue
	jump = old = -1
	for j in range(len(s)):
		if s[j] == 'R':
			jump = max(j - old, jump)
			old = j
	print(max(jump, len(s) - old))


for _ in range(int(input())):
	string = input()
	l = list(string)
	if not 'R' in l:
		print(len(string) + 1)
	else:
		lst = [0]
		for i in range(0, len(string)):
			if string[i] == 'R':
				lst.append(i + 1)
		lst.append(len(string) + 1)
		ans = 0
		for i in range(len(lst) - 1):
			ans = max(ans, lst[i + 1] - lst[i])
		print(ans)


for _ in range(int(input())):
	s = '#' + input().rstrip()
	n = len(s)
	if s.count('R') == 0:
		print(n)
		continue
	(last, now) = (0, 0)
	rast = -1
	for i in range(1, n):
		if s[i] == 'R':
			last = now
			now = i
			rast = max(rast, now - last)
	if s[-1] != 'R':
		rast = max(rast, n - now)
	print(rast)


t = int(input())
ans = []
for _ in range(t):
	s = list(input())
	count = 0
	max = 0
	for i in range(len(s)):
		if s[i] == 'L':
			count += 1
		else:
			if count > max:
				max = count
			count = 0
	if count > max:
		max = count
	ans.append(str(max + 1))
print('\n'.join(ans))


for i in range(int(input())):
	q = input()
	e = []
	if 'R' in list(q):
		w = q.split('R')
		for i in w:
			e.append(len(i))
		print(max(e) + 1)
	else:
		print(len(q) + 1)


for _ in range(int(input())):
	s = input()
	n = len(s)
	x = 0
	m = 0
	for i in range(n):
		if s[i] == 'L':
			x += 1
		else:
			m = max(x, m)
			x = 0
	m = max(m, x)
	print(m + 1)


n = int(input())
for i in range(n):
	s = input()
	s = ' ' + s
	lens = len(s)
	loc = [0]
	if 'R' in s:
		loc = [0] + [j for (j, k) in enumerate(s) if k == 'R']
	loc.append(lens)
	loc_diff = [0] * len(loc)
	for j in range(len(loc) - 1):
		loc_diff[j] = loc[j + 1] - loc[j]
	print(max(loc_diff))


t = int(input())
for i in range(t):
	case = input()
	end = len(case) + 1
	count = 1
	big = 1
	for i in range(len(case)):
		if case[i] == 'L':
			count += 1
			if count > big:
				big = count
		else:
			count = 1
	print(big)


for _ in range(int(input())):
	a = input()
	k = a.split('R')
	lis = []
	for i in k:
		lis.append(len(i))
	print(max(lis) + 1)


T = int(input())
for _ in range(T):
	s = 'R' + input() + 'R'
	(lf, mx) = (0, 1)
	for (i, ch) in enumerate(s):
		if ch == 'R':
			mx = max(mx, i - lf)
			lf = i
	print(mx)


def test(s, d):
	n = len(s)
	idx = 0
	s = 'R' + s + 'R'
	while True:
		if idx == n + 1:
			return True
		unchanged = True
		st = min(idx + d, n + 1)
		for i in range(st, idx, -1):
			if s[i] == 'R':
				idx = i
				unchanged = False
				break
		if unchanged:
			return False
	return None
t = int(input())
for dum in range(t):
	s = input()
	n = len(s)
	p = n + 1
	a = n
	while a >= 1:
		while p - a > 0 and test(s, p - a):
			p = p - a
		a = a // 2
	print(p)


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(ri()):
	a = input()
	m = 0
	s = 0
	for ai in a:
		if ai == 'L':
			s += 1
		else:
			m = max(s, m)
			s = 0
	m = max(s, m)
	print(m + 1)


for _ in range(int(input())):
	s = input()
	mx = 0
	for a in s.split('R'):
		mx = max(mx, len(a))
	print(mx + 1)


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
import functools
import sys
import bisect
import string
import math
import time
import random

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, Directed=False, index=0):
	org_inp = []
	g = [[] for i in range(n)]
	for i in range(E):
		inp = LI()
		org_inp.append(inp)
		if index == 0:
			inp[0] -= 1
			inp[1] -= 1
		if len(inp) == 2:
			(a, b) = inp
			g[a].append(b)
			if not Directed:
				g[b].append(a)
		elif len(inp) == 3:
			(a, b, c) = inp
			aa = (inp[0], inp[2])
			bb = (inp[1], inp[2])
			g[a].append(bb)
			if not Directed:
				g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):
	mp = [1] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [1] + [mp_def[j] for j in s] + [1]
	mp += [1] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

def ran_input():
	n = random.randint(4, 16)
	(rmin, rmax) = (1, 10)
	a = [random.randint(rmin, rmax) for _ in range(n)]
	return (n, a)
show_flg = False
show_flg = True
t = I()
for _ in range(t):
	s = input() + 'R'
	ans = 1
	c = 1
	for i in s:
		if i == 'L':
			c += 1
		else:
			ans = max(ans, c)
			c = 1
	print(ans)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
res = []
for _ in range(ii()):
	s = input()
	ans = 0
	p = -1
	for i in range(len(s)):
		if s[i] == 'R':
			ans = max(ans, i - p)
			p = i
	res.append(max(ans, len(s) - p))
prr(res, '\n')


t = int(input())
for i in range(t):
	x = input()
	r = []
	d = []
	for i in range(len(x)):
		if x[i] == 'R':
			r.append(i)
	if r:
		d.append(r[0] + 1)
		for i in range(1, len(r)):
			d.append(r[i] - r[i - 1])
		d.append(len(x) - r[-1])
		print(max(d))
	else:
		print(len(x) + 1)


for _ in [0] * int(input()):
	s = input()
	x = 1
	arr = []
	for i in s:
		if i == 'L':
			x += 1
		else:
			if x:
				arr.append(x)
			x = 1
	if x:
		arr.append(x)
	print(max(arr))


t = int(input())
for i in range(t):
	way = list(input())
	old_r = 0
	new_r = 0
	for elem in way:
		if elem == 'L':
			new_r += 1
		else:
			old_r = max(old_r, new_r)
			new_r = 0
	old_r = max(old_r, new_r)
	print(old_r + 1)


def testCase():
	env = input()
	record = 0
	lCounter = 0
	for node in env:
		if node == 'L':
			lCounter += 1
		else:
			record = max(record, lCounter)
			lCounter = 0
	record = max(record, lCounter)
	return record + 1
rez = []
t = int(input())
for i in range(t):
	rez.append(testCase())
for r in rez:
	print(r)


t = int(input())
ans = [-1 for i in range(t)]
for i in range(t):
	road = input()
	road += 'R'
	l = -1
	r = -1
	mn = -1
	for j in range(len(road)):
		if road[j] == 'R':
			if l == -1:
				l = j
				mn = l + 1
				continue
			else:
				r = j
				if mn < r - l:
					mn = r - l
				l = r
	ans[i] = mn
for i in ans:
	print(i)


nCases = int(input())
for _ in range(nCases):
	jumps = input()
	bigJump = 1
	curJump = 1
	for j in jumps:
		if j == 'L':
			curJump += 1
		if j == 'R':
			bigJump = max(bigJump, curJump)
			curJump = 1
	print(max(bigJump, curJump))


t = int(input())
for _ in range(t):
	s = input()
	max_n = 1
	n = 1
	for i in range(len(s)):
		if s[i] == 'L':
			n += 1
		else:
			n = 1
		if n > max_n:
			max_n = n
	print(max_n)


from math import *
mod = 1000000007
inf = 10000000000000000

def binpow(a, b):
	global mod
	if b == 1:
		return a % mod
	u = binpow(a, b // 2)
	if b % 2 == 0:
		return u * u % mod
	else:
		return u * u * a % mod

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
temp = [0] * 500
used = [0] * 500

def bs(low, high, target):
	if low == high:
		return low
	elif low + 1 == high:
		if temp[high] > target:
			return low
		else:
			return high
	else:
		mid = (low + high) // 2
		if temp[mid] == target:
			return mid
		elif temp[mid] > target:
			return bs(low, mid - 1, target)
		else:
			return bs(mid, high, target)
for _ in range(int(input())):
	s = input()
	n = len(s)
	last = 0
	maxo = 0
	for i in range(len(s)):
		if s[i] == 'R':
			maxo = max(maxo, i + 1 - last)
			last = i + 1
	maxo = max(maxo, n + 1 - last)
	print(maxo)


import re
pattern = 'L+'
t = int(input())
for i in range(t):
	s = input()
	f = re.findall(pattern, s)
	if f:
		print(len(max(f, key=lambda x: len(x))) + 1)
	else:
		print(1)


for _ in range(int(input())):
	path = input()
	n = len(path)
	L = [0] * (n + 2)
	count = 1
	res = 1
	for x in path:
		if x == 'L':
			count += 1
			res = max(res, count)
		else:
			count = 1
	print(res)


n = int(input())
y = []
for i in range(n):
	k = []
	t = list(input())
	u = 0
	d = 0
	X = 0
	maxi1 = 0
	maxi = 0
	k.append(0)
	for a in range(len(t)):
		if t[a] == 'R':
			k.append(a)
	k.append(len(t))
	for c in range(len(k) - 1):
		maxi1 = k[c + 1] - k[c]
		if maxi1 > maxi:
			maxi = maxi1
			x = c
	if x == 0:
		y.append(maxi + 1)
	elif x == len(k) - 2 and len(k) == 3 and (len(t) == 1):
		y.append(maxi)
	elif x == len(k) - 2 and len(k) < 4:
		y.append(maxi)
	else:
		y.append(maxi)
	k.clear()
for l in range(n):
	print(y[l])


import math as m

def f1():
	Testcases = int(input())
	for i in range(0, Testcases):
		Columns = int(input())
		InAi = [int(j) for j in input().split(' ')]
		Oddf = False
		Evenf = False
		for k in InAi:
			if k % 2 == 0:
				Evenf = True
			else:
				Oddf = True
			if Oddf == True and Evenf == True:
				print('NO')
				break
		if Oddf == False or Evenf == False:
			print('YES')

def f2():
	Testcases = int(input())
	for i in range(0, Testcases):
		N = int(input())
		Array = [int(j) for j in input().split(' ')]
		dict1 = dict()
		flag = False
		for k in range(0, len(Array)):
			if Array[k] in dict1:
				if k - dict1[Array[k]][0] >= 2:
					flag = True
					print('YES')
					break
				dict1[Array[k]].append(k)
			else:
				dict1[Array[k]] = list()
				dict1[Array[k]].append(k)
		if flag == False:
			print('NO')

def f3():
	Testcases = int(input())
	for i in range(0, Testcases):
		String = str(input())
		ListR = list()
		for j in range(0, len(String)):
			if String[j] == 'R':
				ListR.append(j + 1)
		MinR = 0
		if len(ListR) == 0:
			MinR = len(String) + 1
			print(MinR)
			continue
		else:
			MinR = ListR[0]
		for k in range(1, len(ListR)):
			dist = ListR[k] - ListR[k - 1]
			if dist > MinR:
				MinR = dist
		if len(String) + 1 - ListR[-1] > MinR:
			MinR = len(String) + 1 - ListR[-1]
		print(MinR)
f3()


t = int(input())
for x in range(t):
	s = input()
	rr = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			rr.append(i + 1)
	rr.append(len(s) + 1)
	mm = -1
	for i in range(1, len(rr)):
		if rr[i] - rr[i - 1] > mm:
			mm = rr[i] - rr[i - 1]
	print(mm)


import sys

def solve():
	input = sys.stdin.readline
	T = int(input())
	for _ in range(T):
		S = input().strip('\n')
		S += 'R'
		maxL = 0
		start = False
		count = 0
		for i in range(len(S)):
			if S[i] == 'L':
				if start:
					count += 1
				else:
					count = 1
					start = True
			elif start:
				maxL = max(maxL, count)
				start = False
				count = 0
		print(maxL + 1)
	return 0
solve()


t = int(input())
for z in range(t):
	a = input()
	n = len(a)
	l = []
	l.append(0)
	for i in range(len(a)):
		if a[i] == 'R':
			l.append(i + 1)
	l.append(n + 1)
	s = []
	for i in range(1, len(l)):
		s.append(l[i] - l[i - 1])
	s.sort()
	print(s[len(s) - 1])


t = int(input())
for x in range(t):
	s = input()
	max_interval = 1
	count = 1
	i = 0
	while i < len(s):
		if s[i] != 'R':
			count += 1
		else:
			if count > max_interval:
				max_interval = count
			count = 1
		i += 1
	if count > max_interval:
		max_interval = count
	print(max_interval)


for _ in range(int(input())):
	s = input()
	r = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(len(s) + 1)
	ans = 0
	for i in range(len(r) - 1):
		if ans < r[i + 1] - r[i]:
			ans = r[i + 1] - r[i]
	print(ans)


t = int(input())
for test in range(t):
	seq = input()
	if 'R' in seq:
		maxi = max(seq.find('R') + 1, len(seq) - seq.rfind('R'))
		start = 0
		for i in range(len(seq)):
			if seq[i] == 'R':
				if i - start >= maxi:
					maxi = i - start
				start = i
		print(maxi)
	else:
		print(len(seq) + 1)


t = int(input())
for g in range(0, t):
	temp = input()
	temp += 'R'
	s = 'R' + temp
	a = []
	ans = []
	for i in range(0, len(s)):
		if s[i] == 'R':
			a.append(i)
	for i in range(0, len(a) - 1):
		ans.append(a[i + 1] - a[i])
	print(max(ans))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input().rstrip() + '#'
	max_l = 0
	seq_l = 0
	for ch in s:
		if ch == 'L':
			seq_l += 1
		else:
			max_l = max(max_l, seq_l)
			seq_l = 0
	print(max_l + 1)


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	a = []
	a.append(0)
	for i in s:
		a.append(i)
	d = []
	d.append(0)
	for i in range(len(a)):
		if a[i] == 'R':
			d.append(i)
	d.append(len(s) + 1)
	diff = []
	for i in range(len(d) - 1):
		diff.append(d[i + 1] - d[i])
	if len(diff) == 0:
		diff.append(len(s) + 2)
	print(min(max(diff), len(s) + 1))


t = int(input())
g = []
for iggn in range(0, t):
	s = input()
	p = []
	j = 1
	for i in range(0, len(s)):
		if s[i] == 'L':
			j += 1
		if s[i] == 'R' or (s[i] == 'L' and i == len(s) - 1):
			p.append(j)
			j = 1
	g.append(max(p))
for i in g:
	print(i)


for i in range(int(input())):
	s = input()
	e = []
	r = []
	c = 0
	e.append(0)
	for i in range(len(s)):
		if s[i] == 'R':
			e.append(i + 1)
	e.append(len(s) + 1)
	for i in range(len(e) - 1):
		r.append(e[i + 1] - e[i])
	print(max(r))


import sys
input = sys.stdin.readline
for ti in range(int(input().strip())):
	s = input().strip()
	(prev, m) = (0, 0)
	for i in range(len(s)):
		if s[i] == 'R':
			m = max(m, i + 1 - prev)
			prev = i + 1
	m = max(m, len(s) + 1 - prev)
	print(m)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
from bisect import bisect_left as bl
from bisect import bisect_right as br

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def modpow(b, p, m):
	res = 1
	b = b % m
	while p:
		if p & 1:
			res = res * b % m
		b = b * b % m
		p >>= 1
	return res

def mod_inv(a, m):
	return modpow(a, m - 2, m)

def ncr(n, r, m):
	res = 1
	if r == 0:
		return 1
	if n - r < r:
		r = n - r
	(p, k) = (1, 1)
	while r:
		res = res % m * (n % m * mod_inv(r, m) % m) % m
		n -= 1
		r -= 1
	return res

def ncrlis(n, r, m, fact):
	return fact[n] * (mod_inv(fact[r], m) * mod_inv(fact[n - r], m)) % m % m

def ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
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(ii()):
	s = input()
	s = '$' + s + '$'
	d = []
	d.append(0)
	for i in range(len(s)):
		if s[i] == 'R':
			d.append(i)
	d.append(len(s) - 1)
	mx = 0
	for i in range(len(d) - 1):
		mx = max(mx, d[i + 1] - d[i])
	print(mx)


import sys
from collections import *

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	s = [x for x in input()]
	s.append('R')
	n = len(s)
	ans = 0
	temp = 0
	for i in range(n):
		if s[i] == 'L':
			temp += 1
		else:
			ans = max(ans, temp)
			temp = 0
	print(ans + 1)


t = int(input())
for i in range(t):
	leftSeq = list(filter(lambda x: x != '', input().split('R')))
	if len(leftSeq) > 0:
		maiorL = max(leftSeq)
		print(len(maiorL) + 1)
	else:
		print(1)


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
ts = int(ri())
for _ in range(ts):
	st = ri()
	arr = []
	for i in range(len(st)):
		if st[i] == 'R':
			arr.append(i)
	arr = [-1] + arr
	arr.append(len(st))
	ans = -1
	for i in range(len(arr) - 2, -1, -1):
		ans = max(ans, arr[i + 1] - arr[i])
	print(ans)


t = int(input())
for i in range(t):
	s = str(input())
	i = 0
	j = 0
	ma = 0
	while i < len(s):
		nu = 0
		j = i
		while j < len(s) and s[j] == 'L':
			j += 1
			nu += 1
		ma = max(ma, nu)
		i = j + 1
	print(ma + 1)


t = int(input())
while t:
	t -= 1
	s = input()
	max = -1
	n = len(s)
	ind = []
	ind.append(0)
	for i in range(n):
		if s[i] == 'R':
			ind.append(i + 1)
	ind.append(n + 1)
	for i in range(len(ind) - 1):
		if ind[i + 1] - ind[i] > max:
			max = ind[i + 1] - ind[i]
	print(max)


for _ in range(int(input())):
	print(len(max(list(input().split('R')))) + 1)


from sys import stdin

def get_int_input():
	return int(stdin.readline())

def get_str_input():
	return input()

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

def list_input():
	return list(map(int, stdin.readline().split()))
t = get_int_input()
while t:
	t -= 1
	s = get_str_input()
	if all((e == 'R' for e in s)):
		jump = 1
	elif all((e == 'L' for e in s)):
		jump = len(s) + 1
	else:
		x = s[::-1].index('R')
		temp = 0
		y = 0
		for i in range(len(s) - x):
			if s[i] == 'L':
				temp += 1
			else:
				temp = 0
			y = max(y, temp)
		jump = max(x + 1, y + 1)
	print(jump)


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

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

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()
for _ in range(ii()):
	a = lsi()
	c = m = 0
	for i in a:
		if i == 'L':
			c += 1
		else:
			m = max(m, c)
			c = 0
	m = max(c, m)
	print(m + 1)


for _ in range(int(input())):
	s = input()
	ans = 1
	maxi = 1
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			maxi = max(maxi, ans)
			ans = 1
		else:
			ans += 1
	print(max(maxi, ans))


from pprint import pprint
qq = int(input())
import itertools

def countstrs(s):
	return [(k, len(list(g))) for (k, g) in itertools.groupby(s)]
for _ in range(qq):
	s = input()
	d = countstrs(s)
	ma = 0
	for k in d:
		if k[0] == 'L':
			ma = max(ma, k[1])
	print(ma + 1)


t = int(input())
while t:
	s = str(input())
	n = len(s)
	dist = 0
	ans = -1
	for i in range(n):
		if i < n - 1:
			if s[i] == 'R':
				ans = max(ans, dist + 1)
				dist = 0
			else:
				dist += 1
		elif s[i] == 'R':
			ans = max(ans, dist + 1)
			dist = 0
		else:
			dist += 1
			ans = max(ans, dist + 1)
	print(ans)
	t -= 1


t = int(input())
for t_ in range(t):
	s = list(input())
	(cnt, ans) = (1, 1)
	for i in s:
		if i == 'L':
			cnt += 1
		elif i == 'R':
			ans = max(ans, cnt)
			cnt = 1
	ans = max(ans, cnt)
	print(ans)


t = int(input())
for _ in range(t):
	a = input()
	right = [0]
	for i in range(len(a)):
		if a[i] == 'R':
			right.append(i + 1)
	right.append(len(a) + 1)
	_max = -1
	for i in range(len(right) - 1):
		if right[i + 1] - right[i] > _max:
			_max = right[i + 1] - right[i]
	print(_max)


def solution(testCase):
	maxRDist = 0
	currentDist = 0
	testCase += 'R'
	for s in testCase:
		currentDist += 1
		if s == 'R':
			if currentDist > maxRDist:
				maxRDist = currentDist
			currentDist = 0
	return maxRDist

def main():
	t = int(input())
	testCases = []
	for i in range(t):
		testCases.append(input())
	for testCase in testCases:
		print(solution(testCase))
main()


t = int(input())
for i in range(t):
	st = input()
	st = 'R' + st + 'R'
	v = [0] * (len(st) + 1)
	for i in range(1, len(st) + 1):
		if st[i - 1] == 'L':
			v[i] = v[i - 1] + 1
	maxi = -1
	for i in v:
		maxi = max(maxi, i)
	print(maxi + 1)


n = int(input())
for _ in range(n):
	s = str(input())
	ans = len(max(s.split('R'))) + 1
	print(ans)


for _ in range(int(input())):
	s = 'R' + input() + 'R'
	m = -1
	prev_s = 0
	for (i, v) in enumerate(s):
		if v == 'R':
			m = max(i - prev_s, m)
			prev_s = i
	print(m)


def sol(s):
	rs = []
	for i in range(len(s)):
		if s[i] == 'R':
			if len(rs) == 0 and i != 0:
				rs.append(0)
			rs.append(i + 1)
	if not rs:
		return len(s) + 1
	rs.append(len(s) + 1)
	answer = 0
	for i in range(1, len(rs)):
		answer = max(answer, rs[i] - rs[i - 1])
	return answer
for _ in range(int(input())):
	path = input()
	print(sol(path))


for _ in range(int(input())):
	ans = 0
	n = input()
	pos = []
	pos.append(0)
	for i in range(0, len(n)):
		if n[i] == 'R':
			pos.append(i + 1)
	pos.append(len(n) + 1)
	for i in range(0, len(pos) - 1):
		ans = max(ans, pos[i + 1] - pos[i])
	print(ans)


for _ in range(int(input())):
	s = input()
	n = len(s)
	ind = [0]
	for (i, v) in enumerate(s):
		if v == 'R':
			ind.append(i + 1)
	if len(ind) == 0:
		print(n + 1)
		continue
	ind.append(n + 1)
	dif = []
	for i in range(1, len(ind)):
		dif.append(ind[i] - ind[i - 1])
	print(max(dif))


for t in range(int(input())):
	n = input()
	l = len(n)
	last = 0
	res = 0
	for i in range(l):
		if n[i] == 'R':
			res = max(res, i + 1 - last)
			last = i + 1
	res = max(res, l + 1 - last)
	print(res)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	count = []
	temp = 1
	flag = 0
	dp = [0] * n
	for i in range(n):
		if i == 0:
			if s[0] == 'L':
				dp[i] = 1
		elif s[i] == 'L':
			dp[i] = dp[i - 1] + 1
	m = max(dp)
	print(m + 1)


for t in range(int(input())):
	string = input()
	n = len(string)
	ans = -1
	if string.count('R') == 0:
		print(len(string) + 1)
		continue
	f = -1
	s = -1
	f_found = False
	s_found = False
	for i in range(n):
		if f_found and string[i] == 'R':
			s_found = True
			s = i
			if s - f > ans:
				ans = s - f
			f = i
		if string[i] == 'R':
			f_found = True
			f = i
	print(max(max(string.find('R'), string[::-1].find('R')) + 1, ans))


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

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

	def S():
		return stdin.readline().rstrip()

	def Sn():
		return stdin.readline().split(' ')

def Out(whatever):
	return stdout.write(whatever)

def func(s):
	s = ''.join((s, 'R'))
	l = []
	n = len(s)
	for i in range(n):
		if s[i] == 'R':
			l.append(i + 1)
	m = -1
	k = len(l)
	if k == 0:
		return n + 1
	prev = 0
	for i in range(k):
		m = max(m, l[i] - prev)
		prev = l[i]
	return m
t = I()
ans = ['  '] * t
for i in range(t):
	s = S()
	ans[i] = str(func(s))
Out('\n'.join(ans))


testes = int(input())
for t in range(testes):
	string = str(input())
	maior = 0
	atual = -1
	for k in range(len(string)):
		if string[k] == 'R':
			dist = abs(k - atual)
			atual = k
			if maior < dist:
				maior = dist
	dist = abs(len(string) - atual)
	if dist > maior:
		maior = dist
	print(maior)


from sys import stdin
input()
for line in stdin:
	s = line.strip()
	arr = [0] + [idx + 1 for (idx, ch) in enumerate(s) if ch == 'R'] + [len(s) + 1]
	it = iter(arr)
	next(it)
	ans = max(map(lambda p: p[1] - p[0], zip(iter(arr), it)))
	print(ans)


import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

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

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

class Bisect:

	def __init__(self, func):
		self.__func = func

	def bisect_left(self, x, lo, hi):
		while lo < hi:
			mid = (lo + hi) // 2
			if self.__func(mid) < x:
				lo = mid + 1
			else:
				hi = mid
		return lo

	def bisect_right(self, x, lo, hi):
		while lo < hi:
			mid = (lo + hi) // 2
			if x < self.__func(mid):
				hi = mid
			else:
				lo = mid + 1
		return lo

def slv(S):
	S = 'R' + S + 'G'
	N = len(S)

	def dfs(d):
		s = list(range(1, d + 1))
		done = set(s)
		done.add(0)
		di = d + 1
		while s:
			u = s.pop()
			if S[u] == 'R':
				for i in range(max(u + 1, di), u + d + 1):
					if i < N:
						if i not in done:
							s.append(i)
							done.add(i)
				di = u + d + 1
			if N - 1 in done:
				return 1
		return 0
	b = Bisect(dfs)
	return b.bisect_left(1, 0, N)

def main():
	T = read_int()
	for _ in range(T):
		S = read_str()
		print(slv(S))
main()


def run_length_compress(string):
	string = string + '@'
	n = len(string)
	begin = 0
	end = 1
	cnt = 1
	ans = []
	while True:
		if end >= n:
			break
		if string[begin] == string[end]:
			end += 1
			cnt += 1
		else:
			ans.append((cnt, string[begin]))
			begin = end
			end = begin + 1
			cnt = 1
	return ans
import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	s = input()
	s = run_length_compress(s[0:-1])
	ans = 1
	for (num, char) in s:
		if char == 'L':
			ans = max(num + 1, ans)
	print(ans)


import sys
import math
import itertools
from collections import deque
N = 200005
inf = 1 << 30

def solve():
	s = input()
	pos = []
	n = len(s)
	pos.append(0)
	for i in range(n):
		if s[i] == 'R':
			pos.append(i + 1)
	pos.append(n + 1)
	ans = 0
	n = len(pos)
	for i in range(1, n):
		ans = max(ans, pos[i] - pos[i - 1])
	print(ans)
t = int(input())
for case in range(t):
	solve()


t = int(input())
while t > 0:
	s = input()
	ans = 1
	i = 0
	l = len(s)
	while i < len(s):
		if s[i] == 'R':
			i += 1
		else:
			cnt = 1
			j = i
			while j < l and s[j] == 'L':
				j += 1
				cnt += 1
			i = j
			if cnt > ans:
				ans = cnt
	print(ans)
	t -= 1


for TC in range(int(input())):
	s = input()
	result = 0
	r = s.split('R')
	for i in r:
		result = max(result, len(i))
	print(result + 1)


def frog(s):
	c = 0
	z = [0]
	for r in s:
		if r == 'L':
			c += 1
		if r == 'R':
			z.append(c)
			c = 0
	if c != 0:
		z.append(c)
	return max(z) + 1
a = int(input())
for r in range(a):
	m = input()
	o = frog(m)
	print(o)


n = int(input())
for i in range(n):
	s = str(input())
	a = 'R' + s + 'R'
	m = -1
	cur = -1
	for j in range(len(a)):
		if a[j] == 'R':
			m = max(m, j - cur)
			cur = j
	print(m)


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


for _ in range(int(input())):
	s = list(input().split('R'))
	s.sort(reverse=True)
	print(len(s[0]) + 1)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict

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

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

def I():
	return int(stdin.readline())
P = 1000000007
for t in range(I()):
	s = input()
	c = 0
	mx = 0
	for i in range(len(s)):
		if s[i] == 'L':
			c += 1
		else:
			c = 0
		mx = max(c, mx)
	print(mx + 1)


t = int(input())
for _ in range(t):
	s = list(input())
	try:
		k1 = s.index('R')
		s.reverse()
		k2 = s.index('R')
		k3 = 0
		if s.count('R') == 1:
			print(max(k1 + 1, k2 + 1))
		else:
			c = []
			for i in range(len(s)):
				if s[i] == 'R':
					c.append(i)
			p = 0
			for i in range(len(c) - 1):
				p = max(p, c[i + 1] - c[i])
			print(max(p, max(k1 + 1, k2 + 1)))
	except:
		print(len(s) + 1)


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')
testcases = int(input())
for j in range(testcases):
	jumps = input()
	rights = []
	gaps = []
	for s in range(len(jumps)):
		if jumps[s] == 'R':
			rights.append(s)
		if len(rights) == 1:
			gaps.append(rights[0] + 1)
		elif len(rights) >= 2:
			gaps.append(rights[-1] - rights[-2])
	if len(gaps) == 0:
		print(len(jumps) + 1)
	elif len(rights) != 0:
		gaps.append(len(jumps) - rights[-1])
		print(max(gaps))


import sys
input = sys.stdin.readline
import re
for _ in range(int(input())):
	print(max(map(len, re.split('R+', input()[:-1]))) + 1)


t = int(input())
for i in range(t):
	s = input()
	l = list(s)
	s1 = list(set(l))
	if len(s1) == 1:
		if s1[0] == 'L':
			print(len(l) + 1)
		elif s1[0] == 'R':
			print(1)
	else:
		l1 = s.split('R')
		c = 1
		for j in l1:
			x = list(j)
			c = max(c, len(x))
		print(c + 1)


testcase = int(input())
while testcase > 0:
	a = list(input())
	b = list()
	count = 0
	lst = -1
	for i in range(0, len(a)):
		if a[i] == 'R' and count == 0:
			b.append(i + 1)
			count += 1
			lst = i
		elif a[i] == 'R':
			b.append(i - lst)
			count += 1
			lst = i
	if lst == -1:
		b.append(len(a) + 1)
	else:
		b.append(len(a) - lst)
	print(max(b))
	testcase -= 1


for _ in '0' * int(input()):
	s = 'R' + input() + 'R'
	(f, max_r) = (0, 0)
	for i in range(1, len(s)):
		if s[i] == 'R':
			max_r = max(max_r, i - f)
			f = i
	print(max_r)


t = int(input())
for im in range(t):
	s = input()
	n = len(s)
	r = 0
	firstr = -1
	lastr = -1
	cons_gap = -1
	for i in range(n):
		if s[i] == 'R':
			r = 1
			if lastr != -1:
				cons_gap = max(cons_gap, i - lastr)
			lastr = i
			if firstr == -1:
				firstr = i
	if r:
		print(max(n - lastr, firstr + 1, cons_gap))
	else:
		print(n + 1)


t = int(input())
for i in range(t):
	s = input()
	l = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	z = float('-inf')
	for j in range(1, len(l)):
		z = max(l[j] - l[j - 1], z)
	print(z)


for _ in range(int(input())):
	s = input()
	(ctr, ctr2) = (1, 0)
	for i in range(len(s)):
		if s[i] == 'L':
			ctr += 1
		else:
			ctr2 = max(ctr2, ctr)
			ctr = 1
	if s[-1] == 'L':
		ctr2 = max(ctr2, ctr)
	print(ctr2)


def solve(map_):
	max_continuous_l = 0
	continuous_l = 0
	for c in map_:
		if c == 'R':
			if max_continuous_l < continuous_l:
				max_continuous_l = continuous_l
			continuous_l = 0
		elif c == 'L':
			continuous_l += 1
	if max_continuous_l < continuous_l:
		max_continuous_l = continuous_l
	return max_continuous_l + 1
n = int(input())
for i in range(n):
	print(solve(input()))


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	s = IN()
	s = s.split('R')
	print(len(max(s)) + 1)


T = int(input())
for i in range(T):
	n = input()
	l = [0]
	for j in range(len(n)):
		if n[j] == 'R':
			l.append(j + 1)
	diff = []
	for j in range(1, len(l)):
		diff.append(l[j] - l[j - 1])
	diff.append(len(n) + 1 - l[len(l) - 1])
	print(max(diff))


t = int(input())
for el in range(t):
	st = input()
	st = st + 'R'
	v = 0
	f = -1
	s = 0
	while s < len(st):
		if st[s] == 'R':
			v = max(s - f, v)
			f = s
		s += 1
	print(v)


for _ in range(int(input())):
	s = input()
	n = len(s)
	i = 0
	f = 0
	while i < n + 1:
		if i == n:
			m = n + 1
			f = 1
			break
		elif s[i] == 'R':
			m = i + 1
			j = i
			f = 1
			break
		i += 1
	i += 1
	while i < n + 1:
		if i == n:
			m1 = i - j
			if m1 > m:
				m = m1
			j = i
		elif s[i] == 'R' and f == 0:
			j = i
			f = 1
		elif s[i] == 'R' and f == 1:
			m1 = i - j
			if m1 > m:
				m = m1
			j = i
		i += 1
	print(m)


def solve():
	s = input()
	nl = 0
	max_nl = -1
	for i in s:
		if i == 'L':
			nl += 1
		else:
			nl = 0
		max_nl = max(max_nl, nl)
	print(max_nl + 1)

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


t = int(input())
for _ in range(t):
	d = 0
	prev = 0
	str = '0' + input() + '0'
	for i in range(len(str)):
		if str[i] == 'R' or i == len(str) - 1:
			if i - prev > d:
				d = i - prev
			prev = i
	print(d)


for i in range(int(input())):
	t = input()
	s = t.split('R')
	a = [len(str(x)) for x in s]
	print(max(a) + 1)


for t in range(int(input())):
	st = input()
	n = len(st)
	current = -1
	dist = 0
	for i in range(n):
		if st[i] == 'R':
			if i - current > dist:
				dist = i - current
			current = i
	else:
		i = n
		if i - current > dist:
			dist = i - current
		current = i
	if dist == 0:
		print(n + 1)
	else:
		print(dist)


import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	S = 'R' + input().rstrip() + 'R'
	ans = -1
	prv = 0
	for i in range(1, len(S)):
		if S[i] == 'R':
			diff = i - prv
			ans = max(ans, diff)
			prv = i
	print(ans)


import sys
t = int(input())
for _ in range(t):
	nums = input()
	(max_now, max_l) = (0, 0)
	for ch in nums:
		if ch == 'L':
			max_now += 1
			if max_l < max_now:
				max_l = max_now
		else:
			max_now = 0
	print(max_l + 1)


T = int(input())
for case in range(T):
	state = input()
	nums_ = {}
	jump = 1
	max_jump = 1
	for s in state:
		if s == 'L':
			jump += 1
		else:
			max_jump = max(max_jump, jump)
			jump = 1
	max_jump = max(max_jump, jump)
	print(max_jump)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
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')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

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())
MOD = 10 ** 9 + 7

def solve():
	S = listStr()
	best = 0
	curr = 0
	for i in range(len(S)):
		if S[i] == 'L':
			curr += 1
		else:
			best = max(curr, best)
			curr = 0
	best = max(best, curr)
	return best + 1
for _ in range(getInt()):
	print(solve())


testnum = int(input())
res = []
for i in range(testnum):
	a = input()
	res.append(len(a) + 1)
	max = a.find('R') + 1
	for j in range(len(a)):
		if a[j] == 'R':
			if a.find('R', j + 1, len(a)) != -1:
				temp = a.find('R', j + 1, len(a)) - j
			else:
				temp = len(a) - j
			if temp > max:
				max = temp
	if max != 0:
		res[i] = max
for i in range(testnum):
	print(res[i])


def solve():
	s = input()
	l = []
	l.append(0)
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	mx = 0
	for i in range(len(l) - 1):
		mx = max(mx, l[i + 1] - l[i])
	print(mx)
t = int(input())
for _ in range(t):
	solve()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		s = S()
		n = len(s)
		r = 0
		c = -1
		for i in range(n):
			if s[i] == 'L':
				continue
			t = i - c
			if r < t:
				r = t
			c = i
		t = n - c
		if r < t:
			r = t
		rr.append(r)
	return JA(rr, '\n')
print(main())


t = int(input())
for _ in range(t):
	s = input()
	ans = 0
	cnt = 0
	for i in s:
		if i == 'R':
			cnt = 0
			continue
		else:
			cnt += 1
		ans = max(ans, cnt)
	print(ans + 1)


import math
import bisect

def test(data):
	best = 1
	count = 1
	for letter in data:
		if letter == 'L':
			count += 1
			best = max(best, count)
		if letter == 'R':
			count = 1
	return best
T = int(input())
for i in range(T):
	data = list(input())
	print(test(data))


t = int(input())
for i in range(t):
	f = 0
	s = input()
	if 'L' in s:
		pass
	else:
		f = 1
		print('1')
	if 'R' in s:
		pass
	else:
		f = 1
		c = len(s) + 1
		print(c)
	if f != 1:
		d = len(s)
		lst = [-1]
		lst1 = []
		l = list(s)
		for k in range(d):
			if l[k] == 'R':
				lst.append(k)
		lst.append(d)
		for k2 in range(1, len(lst)):
			lst1.append(lst[k2] - lst[k2 - 1])
		print(max(lst1))


from math import *
from collections import *
from operator import itemgetter
import bisect
ii = lambda : int(input())
iia = lambda : list(map(int, input().split()))
isa = lambda : list(input().split())
I = lambda : list(map(int, input().split()))
chrIdx = lambda x: ord(x) - 96
idxChr = lambda x: chr(96 + x)
t = ii()
for i in range(t):
	s = input()
	maxi = 0
	cur = 0
	for i in range(len(s)):
		if s[i] == 'L':
			cur += 1
		else:
			maxi = max(maxi, cur)
			cur = 0
	maxi = max(cur, maxi)
	print(maxi + 1)


for _ in range(int(input())):
	b = list(map(str, input().split('R')))
	h = []
	for i in b:
		h.append(len(i))
	print(max(h) + 1)


t = int(input())
for _ in range(t):
	s = 'R' + input() + 'R'
	dist = -1
	last = 0
	for (i, letter) in enumerate(s):
		if letter == 'R':
			dist = max(i - last, dist)
			last = i
	print(dist)


for i in range(int(input())):
	s = input()
	ans = 0
	cnt = 0
	for j in range(s.find('L'), s.rfind('L') + 1):
		if s[j] == 'L':
			cnt += 1
		else:
			if ans < cnt:
				ans = cnt
			cnt = 0
	print(max(ans, cnt) + 1)


for i in range(int(input())):
	s = input()
	l = []
	l.append('R')
	for j in s:
		l.append(j)
	l.append('R')
	l1 = []
	for j in range(len(l)):
		if l[j] == 'R':
			l1.append(j)
	maxi = 0
	for j in range(len(l1) - 1):
		a = l1[j + 1] - l1[j]
		if maxi < a:
			maxi = a
	print(maxi)


for i in range(int(input())):
	s = str(input())
	s = 'R' + s + 'R'
	a = s.count('R')
	li = []
	if a == len(s):
		print(1)
	elif a == 0:
		print(len(s) - 1)
	else:
		for i in range(len(s)):
			if s[i] == 'R':
				li.append(i)
		max = 0
		for i in range(len(li) - 1):
			if li[i + 1] - li[i] > max:
				max = li[i + 1] - li[i]
		print(max)


querys = int(input())
saida = 0
tamanho = 0
for i in range(querys):
	entrada = list(input())
	entrada.append('R')
	tamanho = len(entrada)
	saida = 1
	for i in range(tamanho - 1, -1, -1):
		if entrada[i] == 'R':
			saida = max(saida, tamanho - i)
			tamanho = i
	if entrada[0] != 'R':
		saida = max(saida, tamanho + 1)
	print(saida)


t = int(input())
for _ in range(t):
	a = input()
	n = len(a)
	x = list(a)
	coun = 0
	for i in x:
		if i == 'L':
			coun += 1
		else:
			coun += 1
			break
	(count, temp) = (1, 1)
	for i in range(1, len(x)):
		if x[i] == x[i - 1] and x[i] == 'L':
			temp += 1
		else:
			count = max(count, temp)
			temp = 1
	if x.count('R') != n:
		count = max(count, temp) + 1
	else:
		count = max(count, temp)
	print(max(count, coun))


for _ in range(int(input())):
	lst = list(input())
	n = len(lst)
	d = 0
	cnt = 0
	for i in range(n):
		if lst[i] == 'L':
			cnt += 1
			if cnt > d:
				d = cnt
		else:
			cnt = 0
	print(d + 1)


for _ in range(int(input())):
	s = list(input())
	l = 1
	ans = 1
	for i in s:
		if i == 'L':
			l += 1
		else:
			ans = max(ans, l)
			l = 1
	ans = max(ans, l)
	print(ans)


from collections import Counter, defaultdict, deque
from heapq import heapify, heappush, heappop, heappushpop
from sys import stdin
int_inp = lambda : int(stdin.readline().strip())
lst_inp = lambda : [int(i) for i in stdin.readline().strip().split(' ')]
str_inp = lambda : stdin.readline().strip()

def solve(s):
	n = len(s) - 1
	max_d = 0
	i = 1
	while i <= n:
		d = 1
		while i <= n and s[i] not in {'R', '#'}:
			d += 1
			i += 1
		max_d = max(d, max_d)
		i += 1
	return max_d
for _ in range(int_inp()):
	s = '#' + str_inp() + '#'
	print(solve(s))


for i in range(int(input())):
	str1 = input()
	R = [0, len(str1) + 1]
	Diff = []
	for j in range(len(str1)):
		if str1[j] == 'R':
			R.append(j + 1)
	R.sort()
	for k in range(len(R) - 1):
		Diff.append(R[k + 1] - R[k])
	print(max(Diff))


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

def solve(S):
	N = len(S)
	minGap = 0
	last = 0
	for (i, x) in enumerate(S, 1):
		if x == 'R':
			minGap = max(minGap, i - last)
			last = i
	minGap = max(minGap, N + 1 - last)
	return minGap
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	S = input().decode().rstrip()
	ans = solve(S)
	print(ans)


import math
t = int(input())
for z in range(t):
	n = input()
	i = count = maxx = 0
	while True:
		if i == len(n):
			break
		if n[i] == 'L':
			count += 1
		else:
			if count > maxx:
				maxx = count
			count = 0
		i += 1
	if count > maxx:
		maxx = count
	if maxx == 0:
		print(1)
	else:
		print(maxx + 1)


t = int(input())
for i in range(0, t):
	s = input()
	n = len(s)
	r = []
	r.append(0)
	for i in range(0, n):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(n + 1)
	ll = len(r)
	mx = 0
	for i in range(0, ll - 1):
		mx = max(mx, r[i + 1] - r[i])
	print(mx)


t = int(input())
for _ in range(t):
	s = input() + 'R'
	prev_r = -1
	min_d = 1
	for (idx, sym) in enumerate(s):
		if sym == 'R':
			min_d = max(min_d, idx - prev_r)
			prev_r = idx
	print(min_d)


t = int(input())
for i in range(t):
	s = input()
	l = []
	a = -1
	for j in range(len(s)):
		if s[j] == 'R':
			l.append(j - a)
			a = j
	l.append(len(s) - a)
	print(max(l))


for i in range(int(input())):
	s = 'R' + input() + 'R'
	prev = 0
	ma = -1
	for i in range(1, len(s)):
		if s[i] == 'R':
			ma = max(ma, i - prev)
			prev = i
	print(ma)


n = int(input())
saida = []
for k in range(n):
	entrada = input()
	aux = []
	i = 0
	while i < len(entrada):
		s = 0
		while entrada[i] == 'L':
			s += 1
			i += 1
			if i == len(entrada):
				break
		if s > 0:
			aux.append(s)
		else:
			i += 1
	aux.sort()
	if len(aux) > 0:
		saida.append(aux[len(aux) - 1] + 1)
	else:
		saida.append(1)
for l in saida:
	print(l)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

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

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

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

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	for test in range(tests):
		arr = insr()
		pivot = len(arr) + 1
		g_max = 1
		for i in range(len(arr) - 1, -1, -1):
			if arr[i] == 'R':
				pivot = i + 1
			else:
				g_max = max(g_max, pivot - i)
		print(g_max)
	return 0
main()


cases = int(input())
while cases > 0:
	aux = input()
	s = 'R'
	s += aux
	s += 'R'
	before = 0
	b = False
	maxi = -1
	for i in range(1, len(s), 1):
		if s[i] == 'R':
			if maxi < i - before:
				maxi = i - before
			before = i
	print(maxi)
	cases -= 1


for _ in range(int(input())):
	s = input()
	cur = 0
	r = [0]
	l = len(s)
	for i in range(l):
		if s[i] == 'R':
			r.append(i + 1)
	r.append(l + 1)
	for i in range(1, len(r)):
		if r[i] - r[i - 1] > cur:
			cur = r[i] - r[i - 1]
	print(cur)


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for __ in range(iin()):
		s = sin()
		n = len(s)
		s = 'R' + s
		x = 0
		maxi = MIN
		for i in range(n + 1):
			if s[i] == 'R':
				maxi = max(maxi, i - x)
				x = i
		maxi = max(maxi, n + 1 - x)
		print(maxi)
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 i in range(t):
	s = input()
	x = [0]
	for j in range(len(s)):
		if s[j] == 'R':
			x.append(j + 1)
	x.append(len(s) + 1)
	x1 = []
	for j in range(1, len(x)):
		x1.append(x[j] - x[j - 1])
	x1.sort()
	print(x1[len(x1) - 1])


t = int(input())
for j in range(0, t):
	s = str(input())
	s = list(s)
	k = 0
	b = []
	for i in range(0, len(s)):
		if s[i] == 'R':
			b.append(i + 1 - k)
			k = i + 1
	b.append(len(s) + 1 - k)
	print(max(b))


t = int(input())
i = 0
while i < t:
	x = [*str(input())]
	lenn = len(x) + 1
	x.append('R')
	maxi = 0
	last = -1
	j = 0
	while j < lenn:
		if x[j] == 'R':
			maxi = max(maxi, j - last)
			last = j
		j += 1
	if maxi == 0:
		print(lenn)
	else:
		print(maxi)
	i += 1


t = int(input())
for _ in range(t):
	s = input()
	if 'R' not in s:
		print(len(s) + 1)
	else:
		p = []
		for i in range(len(s)):
			if s[i] == 'R':
				p.append(i)
		mx = p[0] + 1
		for j in range(1, len(p)):
			mx = max(mx, p[j] - p[j - 1])
		mx = max(mx, len(s) - p[-1])
		print(mx)


for x in range(int(input())):
	d = [x for x in input()]
	if 'L' not in d:
		print(1)
	else:
		i = 0
		c = 0
		for x in range(len(d)):
			if d[x] == 'L':
				c += 1
			else:
				if i < c:
					i = c
				c = 0
		if i < c:
			i = c
		print(i + 1)


t = int(input())
for _ in range(t):
	string = input()
	count = 0
	max_count = 0
	for ch in string:
		if ch == 'L':
			count += 1
		else:
			if count > max_count:
				max_count = count
			count = 0
	if count > max_count:
		max_count = count
	print(max_count + 1)


for _ in range(int(input())):
	a = p = -1
	for (i, c) in enumerate(input().rstrip() + 'R'):
		if c == 'R':
			a = max(a, i - p)
			p = i
	print(a)


for _ in range(int(input())):
	s = input()
	n = len(s)
	maxx = -1
	ch = 'R'
	i = 0
	while i < n:
		count = 1
		while i < n and s[i] != 'R':
			count += 1
			i += 1
		if count > maxx:
			maxx = count
		i += 1
	print(maxx)


def solve(squares):
	r_idx = [i for (i, char) in enumerate(squares) if char == 'R']
	max_dist = -float('inf')
	for i in range(len(r_idx) - 1):
		diff = r_idx[i + 1] - r_idx[i]
		max_dist = max(max_dist, diff)
	return max_dist
t = int(input())
for _ in range(t):
	s = input()
	squares = ['R']
	for char in s:
		squares.append(char)
	squares.append('R')
	print(solve(squares))


a = int(input())
for _ in range(a):
	l = input()
	x = [0]
	for i in range(len(l)):
		if l[i] == 'R':
			x.append(i + 1)
	x.append(len(l) + 1)
	p = 0
	for i in range(0, len(x), 1):
		p = max(p, x[i] - x[i - 1])
	print(p)


T = int(input())
for _ in range(T):
	s = 'R' + input()
	i = len(s)
	d = 1
	while i > 0:
		j = i - 1
		while s[j] != 'R':
			j -= 1
		d = max(d, i - j)
		i = j
	print(d)


quant_testes = int(input())
for c in range(quant_testes):
	seq = input() + 'R'
	maior_slice = 0
	slice_atual = 0
	for char in seq:
		if char == 'L':
			slice_atual += 1
		else:
			if slice_atual > maior_slice:
				maior_slice = slice_atual
			slice_atual = 0
	print(maior_slice + 1)


import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda : int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda : list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda : float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda : list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda : stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda : stdin.readline().split()

def sol():
	s = ns()
	s = 'R' + s + 'R'
	n = len(s)
	ans = -inf
	last = 0
	for i in range(n):
		if s[i] == 'R':
			ans = max(ans, abs(last - i))
			last = i
	print(ans)
for i in range(ni()):
	sol()


from collections import Counter
t = int(input())
for wer in range(t):
	f = 0
	a = list(input().split())
	n = len(a[0])
	x = a[0]
	d = n + 1
	prev = 0
	li = []
	y = 'L' + x
	for i in range(n + 1):
		if y[i] == 'R':
			li.append(i - prev)
			prev = i
	li.append(n + 1 - prev)
	if li:
		d = max(li)
	print(d)


l = int(input())
for _ in range(l):
	last_pos = -1
	max_range = -1
	s = input() + 'R'
	for (index, letter) in enumerate(s):
		if letter == 'L':
			continue
		if letter == 'R':
			if index - last_pos > max_range:
				max_range = index - last_pos
			last_pos = index
	print(max_range)


testcases = int(input())
for i in range(testcases):
	(res, ans) = (-1, 0)
	L1 = list(input())
	L1.append('R')
	L1.insert(0, 'R')
	for idx in range(1, len(L1)):
		if L1[idx] != 'L':
			DIFF = idx - ans
			if DIFF > res:
				res = DIFF
			ans = idx
	print(res)


for _ in range(int(input())):
	str1 = input()
	li = []
	for i in range(len(str1)):
		if str1[i] == 'R':
			li.append(i + 1)
	if len(li) == 0:
		print(len(str1) + 1)
		continue
	a = 0
	ans = 0
	for i in li:
		ans = max(ans, i - a)
		a = i
	ans = max(-li[-1] + 1 + len(str1), ans)
	print(ans)


for _ in range(int(input())):
	s = input()
	mx = -1
	l = 0
	for i in s:
		if i == 'L':
			l += 1
		else:
			mx = max(mx, l)
			l = 0
	mx = max(mx, l)
	print(mx + 1)


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

def zap():
	s = input()
	n = len(s)
	a = []
	ans = 0
	cur = 0
	while cur != n:
		if s[cur] == 'L':
			ans += 1
		else:
			a.append(ans)
			ans = 0
		cur += 1
	a.append(ans)
	return max(a)
for _ in range(int(input())):
	print(zap() + 1)


t = int(input())
for i in range(t):
	s = input()
	s = list(s)
	s.insert(0, 0)
	s.append(0)
	jumps = []
	start = 0
	for i in range(len(s)):
		if s[i] == 'R':
			jumps.append(i - start)
			start = i
	jumps.append(len(s) - 1 - start)
	print(max(jumps))


t = int(input())
for T in range(t):
	s = input()
	m = 0
	cur = -1
	for i in range(len(s)):
		if s[i] == 'R':
			if i - cur > m:
				m = i - cur
			cur = i
	if m == 0:
		print(len(s) + 1)
	else:
		print(max(m, len(s) - cur))


import sys
from collections import Counter

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

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

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

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

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	N = len(S)
	mx = cnt = 0
	for s in S:
		if s == 'L':
			cnt += 1
		else:
			mx = max(mx, cnt)
			cnt = 0
	mx = max(mx, cnt)
	print(mx + 1)


t = int(input())
for _ in range(t):
	sl = list(input())
	p = 0
	ans = 0
	for s in sl:
		if s == 'L':
			p += 1
		else:
			ans = max(ans, p + 1)
			p = 0
	else:
		ans = max(ans, p + 1)
	print(ans)


for _ in range(int(input())):
	s = list(input())
	maxle = 0
	le = 0
	if s[0] == 'L':
		le = 1
	for i in range(1, len(s)):
		if s[i] == 'L':
			le += 1
		else:
			if s[i - 1] == 'L' and maxle < le:
				maxle = le
			le = 0
	if s[-1] == 'L' and le > maxle:
		maxle = le
	print(maxle + 1)


data = input().rstrip().split()
t = int(data[0])
for _ in range(t):
	s = input().rstrip().split('R')
	print(max([len(l) for l in s]) + 1)


for q in range(int(input())):
	s = input() + 'R'
	ind = 0
	res = 0
	x = 0
	while 1:
		x = s.find('R', x)
		if x == -1:
			break
		else:
			res = max(x - ind + 1, res)
			x += 1
			ind = x
	print(res)


t = int(input())
for _ in range(t):
	l = list(input())
	co_max = 0
	co = 1
	for i in range(len(l)):
		if l[i] == 'R':
			co_max = max(co, co_max)
			co = 1
		else:
			co += 1
	if l[-1] == 'L':
		if co_max < co:
			co_max = co
	print(co_max)


for _ in range(int(input())):
	arr = input()
	flagl = 1
	maxx = 1
	flag = 0
	for i in range(len(arr)):
		if arr[i] == 'L':
			flagl += 1
			if flagl > maxx:
				maxx = flagl
		if arr[i] == 'R':
			flag = 1
			flagl = 1
	if flag == 1:
		print(maxx)
	else:
		print(flagl)


t = int(input())
for j in range(t):
	s = input()
	n = len(s)
	v = [0]
	for i in range(n):
		if s[i] == 'R':
			v.append(i + 1)
	v.append(n + 1)
	d = 0
	for i in range(len(v) - 1):
		d = max(d, v[i + 1] - v[i])
	print(d)


for _ in range(int(input())):
	s = input()
	a = []
	s = 'R' + s
	shag = 0
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			a.append(shag + 1)
			shag = 0
		else:
			shag += 1
	print(max(a))


def solve():
	S = 'R' + input().strip() + 'R'
	prev = 0
	max_dist = 0
	for i in range(1, len(S)):
		if S[i] == 'R':
			max_dist = max(max_dist, i - prev)
			prev = i
	print(max_dist)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	s = input()
	a = s.split('R')
	print(len(max(a)) + 1)


for _ in range(int(input())):
	s = input()
	c = 0
	MAX = 0
	for i in s:
		if i == 'L':
			c += 1
		else:
			c = 0
		MAX = max(c, MAX)
	print(MAX + 1)


from sys import stdin
T = int(input())
for _ in range(T):
	s = stdin.readline().split()
	(s,) = s
	N = len(s)
	curr = 0
	rights = []
	for char in range(N):
		if s[char] == 'R':
			rights.append(char)
	if rights == []:
		print(N + 1)
		continue
	dists = []
	dists.append(rights[0] + 1)
	for i in range(len(rights) - 1):
		dists.append(rights[i + 1] - rights[i])
	dists.append(N - rights[-1])
	print(max(dists))


t = int(input())
while t:
	s = input()
	prev = -1
	m = -1
	s += 'R'
	for i in range(len(s)):
		if s[i] == 'R':
			m = max(i - prev, m)
			prev = i
	print(m)
	t -= 1


t = int(input())
while t:
	s = input()
	ans = 0
	temp = 0
	for i in range(len(s)):
		if s[i] == 'L':
			temp += 1
		else:
			ans = max(ans, temp + 1)
			temp = 0
	ans = max(ans, temp + 1)
	print(ans)
	t -= 1


for _ in range(int(input())):
	s = input()
	mn = []
	for i in range(len(s)):
		if s[i] == 'R':
			mn.append(i + 1)
	mn = [0] + mn + [len(s) + 1]
	mnd = 0
	for i in range(1, len(mn)):
		mnd = max(mnd, mn[i] - mn[i - 1])
	print(mnd)


for _ in range(int(input())):
	s = input()
	n1 = len(s)
	s = 'R' + s + 'R'
	n = len(s)
	l = []
	for i in range(n):
		if s[i] == 'R':
			l.append(i)
	if len(l) == 2:
		print(n1 + 1)
	else:
		c = 0
		for i in range(1, len(l)):
			if l[i] - l[i - 1] > c:
				c = l[i] - l[i - 1]
		print(c)


for _ in range(int(input())):
	l = input()
	temp = 0
	ans = 0
	var = -1
	for i in range(len(l) - 1, -1, -1):
		if l[i] == 'R':
			var = i
			break
	for i in range(len(l)):
		if l[i] == 'R':
			ans = max(ans, i + 1 - temp)
			temp = i + 1
	ans = max(ans, len(l) - var)
	print(ans)


def solve():
	s = input()
	s = 'R' + s + 'R'
	max_d = -1
	d1 = -1
	d2 = -1
	for i in range(len(s)):
		if s[i] == 'R':
			if d1 == -1:
				d1 = i
			elif d2 == -1:
				d2 = i
				if d2 - d1 > max_d:
					max_d = d2 - d1
				d1 = i
				d2 = -1
	print(max_d)
for i in range(int(input())):
	solve()


def solve(level):
	ll = 0
	index = 0
	while index < len(level):
		if level[index] == 'R':
			index += 1
		else:
			cll = 0
			while index < len(level) and level[index] != 'R':
				cll += 1
				index += 1
			ll = max(ll, cll)
	return ll + 1

def main():
	t = int(input())
	for i in range(t):
		d = input()
		ans = solve(d)
		print(ans)
main()


import sys
inp = sys.stdin.readline
ans = ''
for _ in range(int(inp())):
	s = inp()
	ans += str(max((len(i) for i in s.strip().split('R'))) + 1) + '\n'
print(ans)


a = int(input())
for _ in range(a):
	b = input()
	c = []
	d = len(b)
	mi = 0
	for x in range(d):
		if b[x] == 'R':
			c.append(x + 1)
	c.insert(0, 0)
	c.append(d + 1)
	for x in range(len(c) - 1):
		if c[x + 1] - c[x] > mi:
			mi = c[x + 1] - c[x]
	print(mi)


lines = int(input())
ans = []
for i in range(lines):
	a = input()
	b = []
	long = 1
	for k in range(len(a)):
		if a[k] == 'R':
			b.append(long)
			long = 1
			end = k
		else:
			long += 1
	if b:
		b.append(len(a) - end)
		ma = max(b)
		ans.append(ma)
	else:
		ans.append(long)
for i in ans:
	print(i)


t = int(input())
for v in range(t):
	s = input()
	left = -1
	ans = 0
	l = len(s)
	for i in range(l):
		if s[i] == 'R':
			ans = max(ans, i - left)
			left = i
	ans = max(ans, l - left)
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	maxi = 0
	prev = -1
	for i in range(n):
		if s[i] == 'R':
			if maxi < i - prev:
				maxi = i - prev
			prev = i
	if prev != n - 1:
		if maxi < n - prev:
			maxi = n - prev
	print(maxi)


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		s = input()
		dist = 1
		t = 1
		for i in range(len(s)):
			if s[i] == 'L':
				t += 1
			else:
				dist = max(t, dist)
				t = 1
		dist = max(t, dist)
		print(dist)
main()


from collections import defaultdict, Counter

def solve(s):
	s = ['*'] + list(s)
	s.append('R')
	x = set()
	prev = 0
	d = 0
	for i in range(len(s)):
		if s[i] == 'R':
			d = max(d, i - prev)
			prev = i
	return d
t = int(input(''))
ans = []
while t > 0:
	n = input('')
	ans.append(solve(n))
	t -= 1
for i in ans:
	print(i)


test = int(input())
for i in range(test):
	str_ = input()
	string = list(str_)
	n = len(string)
	max_so_far = 0
	curr_so_far = 1
	flag = 0
	for i in range(0, n):
		if i < n - 1 and string[i] == string[i + 1] and (string[i] == 'L'):
			curr_so_far += 1
		else:
			if max_so_far < curr_so_far:
				max_so_far = curr_so_far
			curr_so_far = 1
		if string[i] == 'L':
			flag = 1
	if flag == 0:
		print('1')
	else:
		print(max_so_far + 1)


T = int(input())
for _ in range(T):
	s = input()
	maximum = 0
	flag = -1
	n = len(s)
	for i in range(n):
		if s[i] == 'R':
			temp = i - flag
			flag = i
			if temp > maximum:
				maximum = temp
	if n - flag > maximum:
		maximum = n - flag
	print(maximum)


t = int(input())
for i in range(t):
	s = 'R' + input() + 'R'
	max_r = 0
	now_r = 1
	for el in s:
		if el == 'R':
			max_r = max(max_r, now_r)
			now_r = 1
		else:
			now_r += 1
	print(max_r)


for i in range(int(input())):
	s = input()
	maxi = 1
	n = 1
	for j in range(len(s)):
		if s[j] == 'L':
			n += 1
		else:
			if maxi < n:
				maxi = n
			n = 1
	if maxi < n:
		maxi = n
	print(maxi)


def program():
	s = input()
	overall_max = 1
	current_max = 1
	for x in s:
		if x == 'L':
			current_max += 1
		else:
			if overall_max < current_max:
				overall_max = current_max
			current_max = 1
	if overall_max < current_max:
		overall_max = current_max
	print(overall_max)
t = int(input())
for i in range(t):
	program()


n = int(input())
for i in range(n):
	s = input()
	sum = 0
	ss = []
	ss.append(0)
	for j in range(len(s)):
		if s[j] == 'L':
			sum += 1
		if s[j] == 'R' or j == len(s) - 1:
			ss.append(sum)
			sum = 0
	print(max(ss) + 1)


for _ in range(int(input())):
	s = input()
	n = len(s)
	f = 0
	ans = -1
	flag = 0
	for i in range(n):
		if s[i] == 'L':
			f += 1
			flag = 0
		else:
			ans = max(ans, f)
			f = 0
			flag = 1
	if flag == 0:
		ans = max(ans, f)
	if ans == -1:
		print(n + 1)
	else:
		print(ans + 1)


n = int(input())
for k in range(n):
	s = str(input())
	arr = s.split('R')
	maxx = 0
	for i in range(len(arr)):
		if len(arr[i]) > maxx:
			maxx = len(arr[i])
	print(maxx + 1)


n = int(input())
for i in range(0, n):
	S = 0
	s = input().rstrip()
	x = list(s)
	W = []
	for j in range(0, len(x)):
		if x[j] == 'L':
			S += 1
		else:
			W.append(S)
			S = 0
	W.append(S)
	print(max(W) + 1)


t = int(input())
for loop in range(t):
	s = input()
	ans = 0
	now = 0
	for i in s:
		if i == 'R':
			now = 0
		else:
			now += 1
			ans = max(ans, now)
	print(ans + 1)


from itertools import groupby
t = int(input())
for _ in range(t):
	s = input()
	a = [[x, len(list(y))] for (x, y) in groupby(s)]
	if len(a) == 0 and a[0][0] == 'L':
		print(a[0][1] + 1)
	if len(a) == 0 and a[0][0] == 'R':
		print(1)
	else:
		d = 1
		for x in range(len(a)):
			if a[x][0] == 'L':
				d = max(d, a[x][1] + 1)
		print(d)


from sys import stdin
input = stdin.readline

def getAns(s):
	largestGap = 0
	lastR = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			if i - lastR > largestGap:
				largestGap = i - lastR
			lastR = i
	print(largestGap)
n = int(input())
for _ in range(n):
	getAns('R' + input().rstrip() + 'R')


import sys
input = sys.stdin.readline
t = int(input())
for j in range(t):
	s = input().strip().split('R')
	print(max(map(len, s)) + 1)


def solve():
	s = input()
	n = len(s)
	ans = 1
	i = 0
	while i < n:
		if s[i] == 'R':
			i += 1
		else:
			j = i
			while j < n and s[j] == 'L':
				j += 1
			ans = max(ans, j - i + 1)
			i = j
	return ans

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


n = int(input())
for i in range(n):
	jumps = input()
	jumps += 'R'
	resposta = 1
	maior_dist_r = 0
	for jump in jumps:
		if jump == 'L':
			maior_dist_r += 1
		else:
			maior_dist_r += 1
			resposta = max(resposta, maior_dist_r)
			maior_dist_r = 0
	if maior_dist_r != 0:
		resposta = max(resposta, maior_dist_r)
	print(resposta)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input()[:-1]
	l = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			l.append(i + 1)
	l.append(len(s) + 1)
	d = max((l[i + 1] - l[i] for i in range(len(l) - 1)))
	print(d)


q = int(input())
for i in range(q):
	s = 'L' + input() + 'R'
	ans = 0
	l = 0
	for i in range(len(s)):
		if s[i] == 'R':
			if i - l > ans:
				ans = i - l
			l = i
	print(ans)


def max_jump(steps):
	max_step = 0
	lists = [0]
	pointer = 0
	for i in steps:
		lists.append(i)
	lists.append(1)
	for i in range(len(lists)):
		if lists[i] == 'R' or lists[i] == 1:
			if i - pointer > max_step:
				max_step = i - pointer
			pointer = i
	return max_step
T = int(input())
for _ in range(T):
	step = input()
	print(max_jump(step))


t = int(input())
for i in range(t):
	s = input()
	last_r = -1
	s_size = len(s)
	greater_jump = 0
	for c in range(s_size):
		if s[c] == 'R':
			jump = c - last_r
			if jump > greater_jump:
				greater_jump = jump
			last_r = c
	if s_size - last_r > greater_jump:
		greater_jump = s_size - last_r
	print(greater_jump)


t = int(input())
for i in range(t):
	s = input()
	(j, r) = (0, 0)
	(dif, tempDif) = (0, 0)
	while j < len(s):
		if j == 0 and s[j] == 'L':
			j += 1
			tempDif += 1
			while j < len(s) and s[j] == 'L':
				j += 1
				tempDif += 1
			tempDif += 1
			if tempDif > dif:
				dif = tempDif
			tempDif = 0
		if j < len(s) and s[j] == 'R':
			j += 1
			tempDif += 1
			while j < len(s) and s[j] == 'L':
				tempDif += 1
				j += 1
			if tempDif > dif:
				dif = tempDif
			tempDif = 0
		else:
			j += 1
	print(dif)


t = int(input())
for gg in range(t):
	s = 'R' + input() + 'R'
	last = 0
	maxx = 0
	for i in range(1, len(s)):
		if s[i] == 'R':
			if maxx < i - last:
				maxx = i - last
			last = i
	print(maxx)


tests = int(input())

def get_max_left_sequence(string):
	max_count = 0
	count = 0
	flag = False
	for i in range(len(string)):
		if string[i] == 'L' and (not flag):
			flag = True
		elif string[i] == 'R' and flag:
			flag = False
			count = 0
		if flag:
			count += 1
			if count > max_count:
				max_count = count
	return max_count
for i in range(tests):
	string = input()
	max_left_sequence = get_max_left_sequence(string)
	print(max_left_sequence + 1)


t = int(input())
for _ in range(t):
	s = input()
	c = 0
	cm = 0
	for x in s:
		if x == 'L':
			c += 1
		else:
			if c > cm:
				cm = c
			c = 0
	if c > cm:
		cm = c
	print(cm + 1)


import sys

def readInt():
	return int(rl())

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

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

def makeMatrix(a, b, value):
	z = [value] * a
	for i in range(a):
		z[i] = [value] * b
	return z
rl = input
tc = readInt()
while tc:
	tc -= 1
	s = readStr()
	n = len(s)
	ans = 1
	k = 1
	for i in range(n):
		if s[i] == 'L':
			k += 1
		if s[i] == 'R':
			k = 1
		ans = max(ans, k)
	print(ans)


def frog(S):
	n = len(S)
	r = 0
	l = -1
	ans = 0
	while r < n:
		while r < n and S[r] != 'R':
			r += 1
		ans = max(ans, r - l)
		l = r
		r += 1
	return min(ans, n + 1)
t = int(input())
for _ in range(t):
	print(frog(input()))


n = int(input())
for i in range(n):
	t = input()
	t = list(t)
	t = t[::-1]
	count = []
	r = 0
	for i in t:
		if i == 'L':
			r += 1
		if i == 'R':
			count.append(r)
			r = 0
	count.append(r)
	print(max(count) + 1)


for _ in range(int(input())):
	s = input()
	k = 1
	a = []
	for i in s:
		if i == 'L':
			k += 1
		else:
			if k > 0:
				a.append(k)
			k = 1
	if k > 0:
		a.append(k)
	print(max(a))


import sys

def main():
	t = int(input())
	for _ in range(t):
		s = input().strip()
		n = len(s)
		(d, is_l) = (0, False)
		(i, j) = (0, 0)
		while i < n:
			if s[i] == 'L':
				is_l = True
				j = i
				while i < n and s[i] == 'L':
					i += 1
				d = max(d, i - j)
			i += 1
		if is_l:
			print(d + 1)
		else:
			print(1)
main()


for t in range(int(input())):
	s = input()
	x = [-1] + [i for i in range(len(s)) if s[i] == 'R'] + [len(s)]
	print(max([x[i + 1] - x[i] for i in range(len(x) - 1)]))


def process(string):
	m = 0
	lastIndex = -1
	string += 'R'
	for (i, s) in enumerate(string):
		if s == 'R':
			m = max(m, i - lastIndex)
			lastIndex = i
	return m
N = int(input())
for n in range(N):
	s = input()
	print(process(s))


for _ in range(int(input())):
	s = input()
	s = 'R' + s + 'R'
	prevR = 0
	dist = []
	for i in range(1, len(s)):
		if s[i] == 'R':
			dist.append(i - prevR)
			prevR = i
	print(max(dist))


x = 0
x += 1
x = 0
for tini in range(int(input())):
	s = str(input())
	if 'R' not in s:
		print(len(s) + 1)
	elif 'L' not in s:
		print('1')
	else:
		a = []
		for _ in range(len(s)):
			if s[_] == 'R':
				a.append(_)
		b = []
		zz = 0
		tyu = 0
		for _ in range(len(a) - 1):
			b.append(a[_ + 1] - a[_])
		if len(b) > 0:
			print(max(max(b), max(a[0], len(s) - a[len(a) - 1] - 1) + 1))
		else:
			print(max(a[0], len(s) - a[len(a) - 1] - 1) + 1)


from collections import defaultdict
IA = lambda : map(int, input().split())
T = int(input())
for i in range(0, T):
	n = input()
	le = len(n)
	l = int(0)
	pre = 0
	i = 0
	ans = 0
	for it in n:
		i += 1
		if it == 'R':
			ans = max(ans, i - pre)
			pre = i
	ans = max(ans, le + 1 - pre)
	print(ans)


n = int(input())
y = 0
min = 0
for c in range(n):
	b = input()
	for i in range(len(b)):
		if b[i] == 'L':
			y += 1
		else:
			if min < y:
				min = y
			y = 0
	if y > min:
		print(y + 1, '\n')
	else:
		print(min + 1, '\n')
	min = 0
	y = 0


t = int(input())
for i in range(t):
	grid = input()
	ls = [0]
	for j in range(len(grid)):
		if grid[j] == 'R':
			ls.append(j + 1)
	ls.append(len(grid) + 1)
	mx = 0
	for j in range(len(ls) - 1):
		mx = max(mx, ls[j + 1] - ls[j])
	print(mx)


for t in range(int(input())):
	arr = input()
	arr = 'R' + arr
	n = len(arr)
	d = 0
	i = n
	while i >= 0:
		i -= 1
		steps = 0
		while arr[i] != 'R':
			i -= 1
			steps += 1
		if steps > d:
			d = steps
	print(d + 1)


import pdb
queries = int(input())
for _ in range(queries):
	positions = input()
	array = [0]
	for (index, item) in enumerate(positions):
		if item == 'R':
			array.append(index + 1)
	array.append(len(positions) + 1)
	if not array:
		print(len(positions))
	else:
		maxValue = 0
		for index in range(len(array)):
			if index < len(array) - 1:
				maxValue = max(maxValue, array[index + 1] - array[index])
		print(maxValue)


import collections
local = False
if local:
	file = open('A.txt', 'r')

def IN():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def solve(jumps):
	first = len(jumps)
	last = -1
	for i in range(len(jumps)):
		if jumps[i] == 'R':
			first = i
			break
	for i in range(len(jumps) - 1, -1, -1):
		if jumps[i] == 'R':
			last = i
			break
	ans = max(first + 1, len(jumps) - last)
	for i in range(first, len(jumps)):
		if jumps[i] == 'R':
			ans = max(ans, i - first)
			first = i
	return ans
t = int(IN())
for i in range(t):
	jumps = IN()
	print(solve(jumps))


t = int(input())
for i in range(t):
	(now, d) = (0, 0)
	for (pos, ch) in enumerate('R' + input() + 'R'):
		if ch == 'R':
			d = max(d, pos - now)
			now = pos
	print(d)


import math
t = int(input())
for test in range(t):
	st = input()
	longest = 1
	actual = 1
	for i in range(len(st)):
		if st[i] == 'L':
			actual += 1
			if actual > longest:
				longest = actual
		else:
			actual = 1
	print(longest)


n = int(input())
for i in range(n):
	s = input()
	count = 0
	maxcount = 0
	if s.count('L') == len(s):
		maxcount = len(s)
	elif s.count('R') == len(s):
		maxcount = 0
	else:
		for i in s:
			if i == 'L':
				count += 1
			else:
				if count > maxcount:
					maxcount = count
				count = 0
		if count > maxcount:
			maxcount = count
	print(maxcount + 1)


n = int(input())
for _ in range(n):
	s = input().split('R')
	maxi = 0
	for i in s:
		if len(i) > maxi:
			maxi = len(i)
	print(maxi + 1)


import math
import itertools
t = int(input())
for i in range(t):
	s = input()
	max_cl = 0
	prev_pos = None
	for (i, c) in enumerate(s):
		if c == 'L':
			if prev_pos is None:
				prev_pos = i
		elif prev_pos is not None:
			max_cl = max(max_cl, i - prev_pos)
			prev_pos = None
	if prev_pos is not None:
		max_cl = max(max_cl, len(s) - prev_pos)
	print(max_cl + 1)


t = int(input())
while t:
	t -= 1
	s = input()
	ln = len(s)
	if len(''.join(set(s))) == 1:
		if s[0] == 'L':
			print(ln + 1)
		else:
			print(1)
	else:
		mx = -1
		j = -1
		for i in range(ln):
			if s[i] == 'R':
				res = i - j
				j = i
				if mx < res:
					mx = res
			if i == ln - 1:
				res = ln - j
				if res > mx:
					mx = res
		print(mx)


import math
q = int(input())
for _ in range(q):
	s = list(input())
	n = len(s)
	maxx = 0
	k = 0
	for i in range(n):
		if i == 0 and s[i] == 'L':
			k += 1
		elif s[i] == 'L' and s[i - 1] == 'L':
			k += 1
		elif s[i] == 'L' and s[i - 1] == 'R':
			k += 1
		else:
			maxx = max(maxx, k)
			k = 0
	maxx = max(maxx, k)
	print(maxx + 1)


t = int(input())
for i in range(t):
	a = 0
	b = []
	s = input()
	for j in range(len(s)):
		if s[j] == 'L':
			a += 1
		else:
			b.append(a)
			a = 0
	b.append(a)
	b.sort()
	print(b[len(b) - 1] + 1)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	l = []
	prev = s.find('R')
	if prev == -1:
		print(n + 1)
	else:
		l.append(prev + 1)
		start = prev
		for i in range(start, n):
			if s[i] == 'R':
				l.append(i - prev)
				prev = i
		l.append(n - prev)
		print(max(l))


t = int(input())
for i in range(t):
	string = input()
	a = []
	a.append(0)
	for i in range(len(string)):
		if string[i] == 'R':
			a.append(i + 1)
	a.append(len(string) + 1)
	max = 0
	for i in range(len(a) - 1):
		if a[i + 1] - a[i] > max:
			max = a[i + 1] - a[i]
	print(max)


for _ in range(int(input())):
	s = input()
	g = [0]
	for i in range(len(s)):
		if s[i] == 'R':
			g.append(i + 1)
	g.append(len(s) + 1)
	m = 1
	for i in range(len(g) - 1):
		m = max(m, g[i + 1] - g[i])
	print(m)


T = int(input())
for t in range(T):
	S = 'R' + input() + 'R'
	count = 1
	A = []
	for s in S:
		if s == 'R':
			A.append(count)
			count = 1
		else:
			count += 1
	print(max(A))


t = int(input())
for i in range(t):
	strs = 'R' + input() + 'R'
	mx_len = 0
	prev_idx = 0
	for (i, s) in enumerate(strs):
		if i == 0:
			continue
		if s == 'R':
			r_len = i - prev_idx
			prev_idx = i
			if r_len > mx_len:
				mx_len = r_len
	print(mx_len)


import math
n = int(input())
for t in range(n):
	a = list(input())
	maior = 1
	aux = 1
	for i in a:
		if i == 'L':
			aux += 1
		elif aux > maior:
			maior = aux
			aux = 1
		else:
			aux = 1
	if aux > maior:
		maior = aux
	print(maior)


t = int(input())
while t:
	t -= 1
	l = list(input())
	n = len(l)
	i = 0
	j = 0
	ma = 0
	c = 0
	while i < len(l):
		if l[i] == 'L':
			c += 1
		if i + 1 < n and l[i + 1] != 'L':
			if c > ma:
				ma = c
			c = 0
		i += 1
	if c > ma:
		ma = c
	print(ma + 1)


t = int(input())
for tt in range(t):
	s = input()
	i = 0
	p1 = i
	p2 = p1
	tamanho = []
	while i < len(s):
		if s[p2] == 'R' or p2 == len(s) - 1:
			if s[p2] == 'L':
				p2 += 1
			tamanho.append(p2 - p1 + 1)
			p1 = p2 + 1
			p2 = p1
		else:
			p2 += 1
		i += 1
	print(max(tamanho))


for _ in range(int(input())):
	st = input()
	arr = [0]
	for i in range(len(st)):
		if st[i] == 'R':
			arr.append(i + 1)
	arr.append(len(st) + 1)
	maxdiff = 0
	for j in range(len(arr) - 1):
		diff = arr[j + 1] - arr[j]
		maxdiff = diff if diff > maxdiff else maxdiff
	print(maxdiff)


import sys, re
tc = int(sys.stdin.readline())
for _ in range(tc):
	arr = list(sys.stdin.readline().rstrip())
	temp = []
	cnt = 0
	for i in arr:
		if i == 'L':
			cnt += 1
		else:
			temp.append(cnt)
			cnt = 0
	temp.append(cnt)
	print(max(temp) + 1)


n = int(input())
s = []
for i in range(n):
	l = input()
	s.append(l)
for i in range(n):
	p = 0
	cha = 0
	zi_ = []
	cl = []
	for j in s[i]:
		cl.append(j)
	for i in range(len(cl)):
		if cl[i] == 'R':
			cha = i + 1 - p
			p = i + 1
			zi_.append(cha)
	last = len(cl) + 1 - p
	if zi_ == []:
		print(len(cl) + 1)
	elif max(zi_) >= last:
		print(max(zi_))
	elif max(zi_) < last:
		print(last)


for i in range(int(input())):
	seq = input()
	count = set()
	temp = 0
	for j in seq:
		if j == 'L':
			temp += 1
		else:
			count.add(temp)
			temp = 0
	count.add(temp)
	print(str(max(count) + 1))


t = int(input())
for i in range(t):
	s = input()
	distancia = 1
	minimo = 0
	for d in s:
		if d != 'R':
			distancia += 1
		else:
			minimo = max(minimo, distancia)
			distancia = 1
	minimo = max(minimo, distancia)
	distancia = 1
	print(minimo)


for _ in range(int(input())):
	a = input()
	if 'R' not in a:
		print(len(a) + 1)
		continue
	mx = 0
	tc = -1
	a += 'R'
	n = len(a)
	for i in range(n):
		if a[i] == 'R':
			mx = max(mx, i - tc)
			tc = i
	print(mx)


def d_min(seq):
	destination = len(seq)
	possible = [-1]
	for (i, pos) in enumerate(seq):
		if pos == 'R':
			possible.append(i)
	possible.append(destination)
	curr = 0
	for (i, _) in enumerate(possible[1:], start=1):
		if curr < possible[i] - possible[i - 1]:
			curr = possible[i] - possible[i - 1]
	del possible
	print(curr)
for _ in range(int(input())):
	d_min(list(input()))


def solve():
	ans = 0
	s = 'R' + input() + 'R'
	arr = [i for i in range(len(s)) if s[i] == 'R']
	for i in range(len(arr) - 1):
		ans = max(ans, arr[i + 1] - arr[i])
	return ans
t = int(input())
for _ in range(t):
	print(solve())


t = int(input())
for i in range(t):
	a = list(input())
	k = [0]
	for i in range(len(a)):
		if a[i] == 'R':
			k.append(i + 1)
	k.append(len(a) + 1)
	y = []
	for j in range(len(k) - 1):
		y.append(k[j + 1] - k[j])
	print(max(y))


tests = int(input())
for _ in range(tests):
	jumps = input()
	n = len(jumps)
	indices = [0]
	dists = []
	for i in range(n):
		if jumps[i] == 'R':
			indices.append(i + 1)
			dists.append(i - indices[-2] + 1)
	dists.append(n - indices[-1] + 1)
	print(max(dists))


t = int(input())

def reverse(string):
	string = ''.join(reversed(string))
	return string
while t != 0:
	l = input()
	r_l = reverse(l)
	k = []
	first = 0
	s = 0
	flag = 0
	last = 0
	for i in range(len(r_l)):
		if r_l[i] == 'R':
			k.append(i + 1)
			break
	for i in range(len(l)):
		if first == 0 and l[i] == 'R':
			k.append(i + 1)
			s = i
			flag = 1
			first = 1
		elif l[i] == 'R':
			k.append(i - s)
			s = i
	if flag == 0:
		print(len(l) + 1)
	else:
		print(max(k))
	t -= 1


for t in range(int(input())):
	arr = list(map(str, input().split('R')))
	ans = []
	for x in arr:
		ans.append(len(x))
	print(max(ans) + 1)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	count = []
	temp = 1
	flag = 0
	for i in range(n - 1):
		if s[i] == s[i + 1] and s[i] == 'L':
			flag = 1
			temp += 1
		elif flag:
			count.append(temp)
			temp = 1
			flag = 0
		elif s[i] == 'L':
			count.append(temp)
	if flag or s[-1] == 'L':
		count.append(temp)
	if len(count) == 0:
		if n == 1:
			if s[0] == 'L':
				print(2)
			else:
				print(1)
		else:
			print(1)
	else:
		print(max(count) + 1)


from collections import deque
tc = int(input())
for _ in range(tc):
	arr = deque(input())
	lis = [0]
	for q in range(len(arr)):
		if arr[q] == 'R':
			lis.append(q + 1)
	lis.append(len(arr) + 1)
	dist = 0
	for k in range(0, len(lis) - 1):
		dist = max(dist, lis[k + 1] - lis[k])
	print(dist)


for _ in range(int(input())):
	S = input()
	N = len(S)
	(cnt, ans) = (0, 0)
	flag = False
	for i in range(N):
		if S[i] == 'L':
			if flag:
				cnt += 1
			else:
				cnt = 1
				flag = True
			ans = max(ans, cnt)
		else:
			flag = False
	print(ans + 1)


t = int(input())
for i in range(t):
	s = input()
	h = 0
	g = 0
	for j in range(len(s)):
		if s[j] == 'L':
			if j == len(s) - 1:
				h += 1
				g = max(g, h)
			else:
				h += 1
		else:
			g = max(g, h)
			h = 0
	print(g + 1)