C. Frog Jumps

problem_index: C

time_limit: 2 seconds

memory_limit: 256 megabytes

note:
The picture describing the first test case of the example and one of the possible answers:
![image](images/cf_1324_C/1.png)
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.

solutions: ["testcases = int(input())\nfor i in range(testcases):\n\tmoves = input() + 'R'\n\tindex = -1\n\tans = 0\n\tfor i in range(len(moves)):\n\t\tif moves[i] == 'R':\n\t\t\tans = max(ans, i - index)\n\t\t\tindex = i\n\tprint(ans)\n", "n_tests = int(input())\nfor _ in range(n_tests):\n\tstr = input()\n\tprev = -1\n\tmaxx = 0\n\tfor i in range(len(str)):\n\t\tif str[i] == 'R':\n\t\t\ttmp = i - prev\n\t\t\tprev = i\n\t\t\tif tmp > maxx:\n\t\t\t\tmaxx = tmp\n\tif len(str) - prev > maxx:\n\t\tmaxx = len(str) - prev\n\tprint(maxx)\n", "for _ in range(int(input())):\n\tx = input()\n\tp = 0\n\tx = x.replace('R', ' ').split()\n\tif len(x) == 0:\n\t\tprint(1)\n\telse:\n\t\tfor i in x:\n\t\t\tp = max(p, len(i))\n\t\tprint(p + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\ts = s.split('R')\n\ts = [len(x) for x in s]\n\tprint(max(s) + 1)\n", "for case in range(int(input())):\n\tstring = input()\n\tds = []\n\td = 1\n\tlastl = None\n\tfor (i, l) in enumerate(string):\n\t\tif l == 'R':\n\t\t\td = 1\n\t\t\tds.append(d)\n\t\telif i == len(string) - 1:\n\t\t\tif l == 'L':\n\t\t\t\td += 1\n\t\t\tds.append(d)\n\t\telse:\n\t\t\td += 1\n\t\t\tds.append(d)\n\tprint(max(ds))\n", "t = int(input())\nfor _ in range(t):\n\ts = input().strip()\n\tflag = False\n\tbiggest = 0\n\tcount = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > biggest:\n\t\t\t\tbiggest = count\n\t\t\tcount = 0\n\tif count > biggest:\n\t\tbiggest = count\n\tprint(biggest + 1)\n", "t = int(input())\nwhile t:\n\tt = t - 1\n\ts = input()\n\tb = [0]\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tb.append(i + 1)\n\tb.append(len(s) + 1)\n\tans = 0\n\tfor i in range(0, len(b) - 1):\n\t\tans = max(ans, b[i + 1] - b[i])\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = sorted(list(set(s.split('R'))), reverse=True)\n\tprint(len(a[0]) + 1)\n", "querys = int(input())\nwhile querys != 0:\n\tquerys -= 1\n\tmovements = list(input())\n\tj = 0\n\tmax = 0\n\tfind = False\n\ttemp = 0\n\twhile j < len(movements):\n\t\tif movements[j] == 'L':\n\t\t\tfind = True\n\t\telse:\n\t\t\tfind = False\n\t\t\ttemp = 0\n\t\t\tj += 1\n\t\t\tcontinue\n\t\tif find:\n\t\t\ttemp += 1\n\t\tif temp > max:\n\t\t\tmax = temp\n\t\tj += 1\n\tprint(max + 1)\n", "for _ in range(int(input())):\n\thops = []\n\tmove = input()\n\tsize = len(move)\n\t(first, second) = (move.find('R'), move.rfind('R'))\n\tif first + second < 0:\n\t\tprint(size + 1)\n\telif first == second:\n\t\tprint(max(first + 1, size - second))\n\telse:\n\t\thops.append((first + 1, first))\n\t\tfor (x, y) in enumerate(move):\n\t\t\tif y == 'R':\n\t\t\t\thops.append((x + 1 - hops[-1][1], x + 1))\n\t\thops.append((size - second, second))\n\t\tprint(max(hops)[0])\n", "import sys, math\nsys.setrecursionlimit(10 ** 5 + 10)\n\ndef input():\n\treturn sys.stdin.readline()[:-1]\n\ndef main():\n\tq = int(input())\n\tfor _ in range(q):\n\t\ts = 'R' + input() + 'R'\n\t\tt = list(s.split('R'))\n\t\tans = 0\n\t\tfor e in t:\n\t\t\tans = max(ans, len(e) + 1)\n\t\tprint(ans)\nmain()\n", "t = int(input())\nfor ti in range(t):\n\tli = input()\n\tdst = 1\n\tlast = -1\n\tl = 0\n\tml = 0\n\tfor (idx, i) in enumerate(li):\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\t\tml = max(l, ml)\n\t\telse:\n\t\t\tl = 0\n\tprint(ml + 1)\n", "t = int(input())\n\ndef dist(seq=''):\n\tdistance = 1\n\tdist_max = 1\n\tfor i in seq:\n\t\tif i == 'R':\n\t\t\tif distance > dist_max:\n\t\t\t\tdist_max = distance\n\t\t\tdistance = 1\n\t\tif i == 'L':\n\t\t\tdistance += 1\n\tif distance > dist_max:\n\t\tdist_max = distance\n\treturn dist_max\nfor row in range(t):\n\tc = input()\n\tprint(dist(c))\n", "num_de_testes = int(input())\nfor i in range(num_de_testes):\n\tcaso_de_teste = input()\n\t(aux, valor_min, i) = (1, 0, 0)\n\twhile i < len(caso_de_teste):\n\t\tif caso_de_teste[i] != 'R':\n\t\t\taux += 1\n\t\telse:\n\t\t\tif aux > valor_min:\n\t\t\t\tvalor_min = aux\n\t\t\taux = 1\n\t\ti += 1\n\tif aux > valor_min:\n\t\tvalor_min = aux\n\tprint(valor_min)\n", "def main():\n\timport sys\n\tinput = sys.stdin.readline\n\tfor _ in range(int(input())):\n\t\tS = input().rstrip('\\n')\n\t\tcnt = 0\n\t\tans = 1\n\t\tfor s in S:\n\t\t\tif s == 'L':\n\t\t\t\tcnt += 1\n\t\t\t\tans = max(ans, cnt + 1)\n\t\t\telse:\n\t\t\t\tcnt = 0\n\t\tprint(ans)\n\ndef __starting_point():\n\tmain()\n__starting_point()\n", "n = int(input())\nfor _ in range(n):\n\ts = input()\n\tLL = 0\n\tneed = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tLL += 1\n\t\telse:\n\t\t\tneed = max(need, LL)\n\t\t\tLL = 0\n\t\tneed = max(need, LL)\n\tprint(need + 1)\n", "for i in range(int(input())):\n\ts = input()\n\tl = ['R'] + list(s)\n\tmaxx = 0\n\tprev = 0\n\tfor i in range(1, len(l)):\n\t\tif l[i] == 'R':\n\t\t\td = i - prev\n\t\t\tprev = i\n\t\t\tif d >= maxx:\n\t\t\t\tmaxx = d\n\tmaxx = len(l) if maxx == 0 else maxx\n\tfor i in range(len(l) - 1, -1, -1):\n\t\tif l[i] == 'R':\n\t\t\tmdfc = len(l) - i\n\t\t\tbreak\n\tprint(mdfc if mdfc > maxx else maxx)\n", "T = int(input())\nfor t in range(T):\n\tA = input()\n\tn = len(A)\n\tB = [0]\n\tfor i in range(n):\n\t\tif A[i] == 'R':\n\t\t\tB.append(i + 1)\n\tB.append(n + 1)\n\tans = 0\n\tfor i in range(len(B) - 1):\n\t\tans = max(ans, B[i + 1] - B[i])\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tm = -1\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans = max(i - m, ans)\n\t\t\tm = i\n\tprint(max(ans, n - m))\n", "for _ in range(int(input())):\n\tstrr = input()\n\tb = [0]\n\tk = 0\n\tmaxx = b[k]\n\tfor i in range(len(strr)):\n\t\tif strr[i] == 'R':\n\t\t\tb.append(i + 1)\n\t\t\tif b[k + 1] - b[k] > maxx:\n\t\t\t\tmaxx = b[k + 1] - b[k]\n\t\t\tk = k + 1\n\t\tif i == len(strr) - 1:\n\t\t\tb.append(len(strr) + 1)\n\t\t\tif b[k + 1] - b[k] > maxx:\n\t\t\t\tmaxx = b[k + 1] - b[k]\n\t\t\tk = k + 1\n\tprint(maxx)\n", "n = int(input())\nfor i in range(n):\n\tjumps = list(input())\n\tl = 0\n\tr = 1\n\tcount = 1\n\twhile l < len(jumps) and r < len(jumps):\n\t\tif jumps[l] != jumps[r]:\n\t\t\tif jumps[l] == 'L':\n\t\t\t\tcount = max(count, 1 + r - l)\n\t\t\tl = r\n\t\tr += 1\n\tif jumps[l] == 'L':\n\t\tcount = max(count, 1 + r - l)\n\tprint(count)\n", "for i in range(int(input())):\n\tdistance = 0\n\tdummy = []\n\tlineup = [0] + list(input()) + [0]\n\tfor i in lineup:\n\t\tif i == 0 or i == 'R':\n\t\t\tdummy.append(distance)\n\t\t\tdistance = 0\n\t\telse:\n\t\t\tdistance += 1\n\tprint(max(dummy) + 1)\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\ts = input()\n\t(d, dPos) = (0, 0)\n\tfor i in range(len(s) - 1):\n\t\tif s[i] == 'R':\n\t\t\tif i + 1 - dPos > d:\n\t\t\t\td = i + 1 - dPos\n\t\t\tdPos = i + 1\n\tif len(s) - dPos > d:\n\t\td = len(s) - dPos\n\tprint(d)\n", "t = int(input())\nwhile t > 0:\n\tb = input()\n\ta = '{}{}{}'.format('R', b, 'R')\n\tn = len(a)\n\th = 0\n\tMax = 0\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tk = i - h\n\t\t\tif k > Max:\n\t\t\t\tMax = k\n\t\t\th = i\n\tprint(Max)\n\tt -= 1\n", "for _ in range(int(input(''))):\n\ts = list(input(''))\n\tdp = [0] * (len(s) + 1)\n\tn = len(s)\n\tfor j in range(n):\n\t\tif s[j] == 'L':\n\t\t\tdp[j + 1] = dp[j] + 1\n\tfor i in range(n + 1):\n\t\tdp[i] += 1\n\tprint(max(dp))\n", "def solve():\n\tstr = input()\n\tans = []\n\tans.append(0)\n\tfor i in range(len(str)):\n\t\tif str[i] == 'R':\n\t\t\tans.append(i + 1)\n\tans.append(len(str) + 1)\n\tres = 0\n\tfor i in range(len(ans)):\n\t\tif i == 0:\n\t\t\tcontinue\n\t\tif ans[i] - ans[i - 1] > res:\n\t\t\tres = ans[i] - ans[i - 1]\n\treturn res\nt = int(input())\nwhile t > 0:\n\tprint(solve())\n\tt -= 1\n", "t = int(input())\nfor i in range(t):\n\ts = list(input().strip())\n\tr = 0\n\tt = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tt = t + 1\n\t\telse:\n\t\t\tif t > r:\n\t\t\t\tr = t\n\t\t\tt = 0\n\tif t > r:\n\t\tr = t\n\tprint(r + 1)\n", "for _ in range(int(input())):\n\ts = 'R' + input()\n\tprev = 0\n\tmax_dist = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmax_dist = max(max_dist, i - prev)\n\t\t\tprev = i\n\tmax_dist = max(max_dist, len(s) - prev)\n\tprint(max_dist)\n", "from __future__ import division, print_function\n\ndef get_ints():\n\treturn map(int, input().strip().split())\n\ndef get_array():\n\treturn list(map(int, input().strip().split()))\n\ndef main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\tarr = list(s)\n\t\t(cnt, res) = (-1, [0])\n\t\tfor i in range(len(arr)):\n\t\t\tif arr[i] == 'R':\n\t\t\t\tres.append(i + 1)\n\t\tres.append(len(s) + 1)\n\t\tfor i in range(len(res) - 1):\n\t\t\tcnt = max(cnt, res[i + 1] - res[i])\n\t\tprint(cnt)\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nimport os, sys\nfrom io import IOBase, BytesIO\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "from bisect import bisect_left, bisect_right\n\ndef go():\n\ts = input()\n\tprev = -1\n\tmx = 0\n\tfor (i, aa) in enumerate(s):\n\t\tif aa == 'R':\n\t\t\tmx = max(mx, i - prev)\n\t\t\tprev = i\n\treturn max(mx, len(s) - prev)\nt = int(input())\nfor _ in range(t):\n\tprint(go())\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = s + 'R'\n\tmax_d = 1\n\takt_d = 1\n\tpredosle_R = True\n\tfor smer in s:\n\t\tif smer == 'L' and (not predosle_R):\n\t\t\takt_d = akt_d + 1\n\t\tif smer == 'L' and predosle_R:\n\t\t\takt_d = 1\n\t\t\tpredosle_R = False\n\t\tif smer == 'R' and (not predosle_R):\n\t\t\takt_d = akt_d + 1\n\t\t\tmax_d = max(akt_d, max_d)\n\t\t\tpredosle_R = True\n\tprint(max_d)\n", "tests = int(input())\nfor test in range(tests):\n\ts = input()\n\tans = 0\n\tcur = 0\n\tfor c in s:\n\t\tif c == 'R':\n\t\t\tans = max(cur, ans)\n\t\t\tcur = 0\n\t\telse:\n\t\t\tcur += 1\n\tans = max(cur, ans)\n\tprint(ans + 1)\n", "for _ in range(int(input())):\n\ts = 'R' + input()\n\tm = 0\n\tr = True\n\tt = 0\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R' and r == False:\n\t\t\tr = True\n\t\t\tm = max(t, m)\n\t\t\tt = 0\n\t\telif s[i] == 'L':\n\t\t\tr = False\n\t\t\tt += 1\n\tprint(m + 1)\n", "t = int(input())\nfor i in range(t):\n\tar = input()\n\tm = 0\n\tp = -1\n\tfor i in range(len(ar)):\n\t\tif ar[i] == 'R':\n\t\t\tm = max(m, i - p)\n\t\t\tp = i\n\tm = max(m, len(ar) - p)\n\tprint(m)\n", "from bisect import bisect_left as bl, bisect_right as br, insort\nimport sys\nimport heapq\nfrom collections import defaultdict as dd, deque\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef mdata():\n\treturn map(int, data().split())\n\ndef conv(x):\n\treturn bin(x).replace('0b', '')\nfor t in range(int(data())):\n\ts = input()\n\tans = 0\n\tk = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - k)\n\t\t\tk = i\n\tans = max(ans, len(s) - k)\n\tprint(ans)\n", "t = int(input())\nM = []\n\ndef fonction(s):\n\tif 'L' not in s:\n\t\treturn 1\n\telif 'R' not in s:\n\t\treturn len(s) + 1\n\telse:\n\t\tL = s.split('R')\n\t\treturn len(max(L)) + 1\nfor i in range(t):\n\ts = input()\n\tM.append(fonction(s))\nfor k in M:\n\tprint(k)\n", "(z, zz) = (input, lambda : list(map(int, z().split())))\nzzz = lambda : [int(i) for i in stdin.readline().split()]\n(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))\nfrom string import *\nfrom re import *\nfrom collections import *\nfrom queue import *\nfrom sys import *\nfrom collections import *\nfrom math import *\nfrom heapq import *\nfrom itertools import *\nfrom bisect import *\nfrom collections import Counter as cc\nfrom math import factorial as f\nfrom bisect import bisect as bs\nfrom bisect import bisect_left as bsl\nfrom itertools import accumulate as ac\n\ndef lcd(xnum1, xnum2):\n\treturn xnum1 * xnum2 // gcd(xnum1, xnum2)\n\ndef prime(x):\n\tp = ceil(x ** 0.5) + 1\n\tfor i in range(2, p):\n\t\tif x % i == 0 and x != 2 or x == 0:\n\t\t\treturn 0\n\treturn 1\n\ndef dfs(u, visit, graph):\n\tvisit[u] = True\n\tfor i in graph[u]:\n\t\tif not visit[i]:\n\t\t\tdfs(i, visit, graph)\nnum = int(z())\nfor _ in range(num):\n\tl = list(map(len, z().split('R')))\n\tprint(max(l) + 1)\n", "for _ in range(int(input())):\n\ta = input()\n\tc = 1\n\tm = []\n\tz = 0\n\tfor j in a:\n\t\tif j == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c:\n\t\t\t\tm.append(c)\n\t\t\tc = 1\n\tif c:\n\t\tm.append(c)\n\tprint(max(m))\n", "for _ in range(int(input())):\n\ts = input() + 'R'\n\tn = len(s)\n\t(ans, tmp) = (0, 0)\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\ttmp += 1\n\t\telse:\n\t\t\tans = max(ans, tmp)\n\t\t\ttmp = 0\n\tprint(ans + 1)\n", "for _ in range(int(input())):\n\tl = input()\n\tmaxi = 0\n\tcurrent = l[0]\n\ti = 0\n\tvalue = 0\n\twhile i < len(l):\n\t\tif l[i] == 'L':\n\t\t\tvalue += 1\n\t\telse:\n\t\t\tvalue = 0\n\t\ti += 1\n\t\tmaxi = max(value, maxi)\n\tprint(maxi + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tlast = s[0]\n\tcount = 1\n\tmx = 1\n\tfor j in range(1, len(s)):\n\t\tif last == s[j] and last == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 1\n\t\tif count > mx:\n\t\t\tmx = count\n\t\tlast = s[j]\n\tif 'L' in s:\n\t\tprint(mx + 1)\n\telse:\n\t\tprint(1)\n", "for i in range(int(input())):\n\ts = input()\n\tlast = s[0]\n\tr = 0 if last == 'R' else 1\n\tl = 0\n\tfor i in s[1:]:\n\t\tif i == 'R':\n\t\t\tif r > l:\n\t\t\t\tl = r\n\t\t\tr = 0\n\t\telse:\n\t\t\tr += 1\n\tif s[-1] != 'R':\n\t\tif r > l:\n\t\t\tl = r\n\tprint(l + 1)\n", "import sys\nI = sys.stdin.readline\nans = ''\nfor _ in range(int(I())):\n\ts = I()\n\ts = s[0:len(s) - 1]\n\tif 'R' not in s:\n\t\tans += '{}\\n'.format(len(s) + 1)\n\telif 'L' not in s:\n\t\tans += '{}\\n'.format(1)\n\telse:\n\t\tr = []\n\t\ti = 0\n\t\tj = i\n\t\twhile i < len(s) and j < len(s):\n\t\t\tif s[i] == 'R':\n\t\t\t\tj = i + 1\n\t\t\t\twhile j < len(s):\n\t\t\t\t\tif s[j] == 'R':\n\t\t\t\t\t\tr.append(j - i)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tj += 1\n\t\t\ti += 1\n\t\tr.append(s.index('R') + 1)\n\t\tr.append(s[::-1].index('R') + 1)\n\t\tans += '{}\\n'.format(max(r))\nprint(ans)\n", "def solve(frog):\n\tdiff = [0]\n\tarr = []\n\tfor (i, v) in enumerate(frog):\n\t\tif v == 'R':\n\t\t\tdiff.append(i + 1)\n\tdiff.append(len(frog) + 1)\n\tans = 0\n\tfor i in range(len(diff) - 1):\n\t\tans = max(ans, diff[i + 1] - diff[i])\n\treturn ans\nfor _ in range(int(input())):\n\tfrog = input()\n\tprint(solve(frog))\n", "t = int(input())\nstrings = []\nfor x in range(t):\n\tstrings.append(input())\nfor string in strings:\n\tcont = 1\n\tresp = 1\n\tfor c in string:\n\t\tif c == 'L':\n\t\t\tcont += 1\n\t\telse:\n\t\t\tresp = max(cont, resp)\n\t\t\tcont = 1\n\tresp = max(cont, resp)\n\tprint(resp)\n", "n = int(input())\nfor j in range(n):\n\tmaxi = -1\n\tprev = 0\n\ta = '0'\n\ta += str(input())\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tif i - prev > maxi:\n\t\t\t\tmaxi = i - prev\n\t\t\tprev = i\n\tif len(a) - prev > maxi:\n\t\tmaxi = len(a) - prev\n\tprint(maxi)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = t = 0\n\tres = 'R' + s + 'R'\n\tfor i in range(len(res)):\n\t\tif res[i] == 'R':\n\t\t\tif a < i - t:\n\t\t\t\ta = i - t\n\t\t\tt = i\n\tprint(a)\n", "t = int(input())\nfor i in range(0, t):\n\tx = []\n\ts = input()\n\tfor j in range(0, len(s)):\n\t\tif s[j] == 'R':\n\t\t\tx.append(j + 1)\n\t\telse:\n\t\t\tcontinue\n\tif len(x) == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\ty = [x[0], len(s) + 1 - x[len(x) - 1]]\n\t\tfor j in range(0, len(x) - 1):\n\t\t\tc = x[j + 1] - x[j]\n\t\t\ty.append(c)\n\t\tprint(max(y))\n", "from sys import stdin\n\ndef main():\n\treadline = stdin.readline\n\tt = int(readline())\n\tres = []\n\tfor i in range(t):\n\t\ts = readline().strip()\n\t\tcount = 0\n\t\tmax_count = 0\n\t\tl_flag = False\n\t\tfor j in range(len(s)):\n\t\t\tif s[j] == 'L' and l_flag == False:\n\t\t\t\tl_flag = True\n\t\t\t\tcount += 1\n\t\t\t\tif j == len(s) - 1:\n\t\t\t\t\tmax_count = max(count, max_count)\n\t\t\telif s[j] == 'L' and l_flag:\n\t\t\t\tcount += 1\n\t\t\t\tif j == len(s) - 1:\n\t\t\t\t\tmax_count = max(count, max_count)\n\t\t\telif s[j] == 'R' and l_flag:\n\t\t\t\tmax_count = max(count, max_count)\n\t\t\t\tl_flag == False\n\t\t\t\tcount = 0\n\t\tres.append(max_count + 1)\n\tfor i in range(t):\n\t\tprint(res[i])\nmain()\n", "test_case = int(input())\nwhile test_case:\n\tlist = input()\n\tlist = 'L' + list + 'R'\n\tclosest_r = 0\n\tdist = 0\n\tfor i in range(len(list)):\n\t\tif list[i] == 'R':\n\t\t\tdist = max(dist, i - closest_r)\n\t\t\tclosest_r = i\n\tprint(dist)\n\ttest_case -= 1\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tflag = True\n\tc = 0\n\tmi = 1\n\tfor i in range(len(s)):\n\t\tif flag and s[i] == 'L':\n\t\t\tc = 2\n\t\t\tflag = False\n\t\telif not flag and s[i] == 'L':\n\t\t\tc += 1\n\t\telif not flag and s[i] == 'R':\n\t\t\tflag = True\n\t\t\tif mi < c:\n\t\t\t\tmi = c\n\t\telse:\n\t\t\tpass\n\tif mi < c:\n\t\tmi = c\n\tprint(mi)\n", "def solve(s):\n\tmax_diff = 0\n\tprev_idx = -1\n\ts = s + 'D'\n\ts = 'S' + s\n\tn = len(s)\n\tfor i in range(0, n):\n\t\tif s[i] == 'S':\n\t\t\tprev_idx = i\n\t\telif s[i] == 'R':\n\t\t\tmax_diff = max(max_diff, i - prev_idx)\n\t\t\tprev_idx = i\n\t\telif s[i] == 'D':\n\t\t\tmax_diff = max(max_diff, i - prev_idx)\n\treturn max_diff\nt = int(input())\nresults = list()\nfor _ in range(0, t):\n\ts = input()\n\tresults.append(solve(s))\nfor result in results:\n\tprint(result)\n", "n1 = int(input())\nfor u in range(n1):\n\ts = input()\n\tmq = 0\n\tm = 0\n\tmqe = ''\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tmq += 1\n\t\t\tif mq > m:\n\t\t\t\tm = mq\n\t\telse:\n\t\t\tmq = 0\n\tprint(m + 1)\n", "for _ in range(int(input())):\n\ta = list(input())\n\tk = 0\n\tshit = 0\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\tk += 1\n\t\telse:\n\t\t\tif k > shit:\n\t\t\t\tshit = k\n\t\t\tk = 0\n\tif k > shit:\n\t\tshit = k\n\tprint(shit + 1)\n", "import sys\ninput = sys.stdin.readline\ntc = int(input())\nfor i in range(tc):\n\ts = input().rstrip()\n\tn = len(s)\n\tm = 0\n\ti = 0\n\twhile i < n:\n\t\tj = i\n\t\twhile j < n and s[j] == 'L':\n\t\t\tj += 1\n\t\tm = max(j - i, m)\n\t\ti = j + 1\n\tprint(m + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tle = 0\n\tm = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tle += 1\n\t\telse:\n\t\t\tif le > m:\n\t\t\t\tm = le\n\t\t\tle = 0\n\t\tif le > m:\n\t\t\tm = le\n\tprint(m + 1)\n", "cases = int(input())\nfor _ in range(cases):\n\tjumps = input()\n\tmax_jump = 1\n\tprev_r = -1\n\tfor i in range(len(jumps)):\n\t\tif jumps[i] == 'R':\n\t\t\tmax_jump = max(i - prev_r, max_jump)\n\t\t\tprev_r = i\n\tmax_jump = max(max_jump, len(jumps) - prev_r)\n\tprint(max_jump)\n", "def jump(arr):\n\tpos = []\n\tpos.append(0)\n\tfor (i, ch) in enumerate(arr):\n\t\tif ch == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(len(arr) + 1)\n\tans = 0\n\tfor i in range(len(pos) - 1):\n\t\tans = max(ans, pos[i + 1] - pos[i])\n\treturn ans\nn = int(input())\nfor _ in range(n):\n\ts = list(input())\n\tprint(jump(s))\n", "def check(S, X):\n\tN = len(S)\n\tI = -1\n\twhile I < N:\n\t\tif N <= X + I:\n\t\t\treturn True\n\t\tP = False\n\t\tfor j in range(1, X + 1):\n\t\t\tif S[I + j] == 'R':\n\t\t\t\tI += j\n\t\t\t\tP = True\n\t\t\t\tbreak\n\t\tif not P:\n\t\t\treturn False\nfor _ in range(int(input())):\n\tS = input()\n\tL = 1\n\tR = len(S) + 1\n\twhile L < R:\n\t\tM = (L + R) // 2\n\t\tif check(S, M):\n\t\t\tR = M\n\t\telse:\n\t\t\tL = M + 1\n\tprint(L)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = []\n\tcount = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'L' and count == 0:\n\t\t\tcount = 1\n\t\telif s[i] == 'L' and count > 0:\n\t\t\tcount += 1\n\t\telse:\n\t\t\ta.append(count)\n\t\t\tcount = 0\n\tif count > 0:\n\t\ta.append(count)\n\tprint(max(a) + 1)\n", "from sys import stdin, stdout\nfor _ in range(int(stdin.readline())):\n\ts = input() + 'R'\n\tn = len(s)\n\tans = 0\n\tprev = -1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - prev)\n\t\t\tprev = i\n\tprint(ans if ans != 0 else n + 1)\n", "import sys\nfor i in range(int(sys.stdin.readline())):\n\ts = sys.stdin.readline().strip()\n\ts += 'R'\n\tm = 0\n\tlc = 1\n\tfor j in s:\n\t\tif j == 'L':\n\t\t\tlc += 1\n\t\t\tcontinue\n\t\tm = max(lc, m)\n\t\tlc = 1\n\tprint(m)\n", "a = int(input())\nfor _ in range(a):\n\tl = input() + 'R'\n\tx = 0\n\tm = 0\n\tfor i in range(len(l)):\n\t\tif l[i] == 'L':\n\t\t\tx += 1\n\t\telse:\n\t\t\tm = max(m, x)\n\t\t\tx = 0\n\tprint(m + 1)\n", "t = int(input())\nfor t1 in range(0, t):\n\ts1 = input()\n\tn = len(s1)\n\tf = 0\n\tflag = -1\n\tok = 0\n\tfor i in range(0, n):\n\t\tif s1[i] == 'L':\n\t\t\tf = f + 1\n\t\t\tok = 0\n\t\telse:\n\t\t\tflag = max(flag, f)\n\t\t\tf = 0\n\t\t\tok = 1\n\tif ok == 0:\n\t\tflag = max(flag, f)\n\tif flag == -1:\n\t\tprint(n + 1)\n\telse:\n\t\tprint(flag + 1)\n", "for _ in range(int(input())):\n\t(a, b) = (0, 0)\n\ts = input()\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\ta += 1\n\t\telif a == 0 or a == b:\n\t\t\ta = 0\n\t\t\tcontinue\n\t\telse:\n\t\t\tb = max(b, a)\n\t\t\ta = 0\n\tprint(max(a, b) + 1)\n", "t = int(input())\nfor query in range(t):\n\tj = list(input())\n\ty = 0\n\tz = 1\n\tj.append('R')\n\tfor x in j:\n\t\tif x == 'R':\n\t\t\tif z > y:\n\t\t\t\ty = z\n\t\t\t\tz = 1\n\t\t\telse:\n\t\t\t\tz = 1\n\t\telse:\n\t\t\tz = z + 1\n\tprint(y)\n", "T = int(input())\nfor test in range(T):\n\tmax = -1\n\tcount = 0\n\tlst = ['R']\n\tlst.extend(list(input()))\n\tlst.append('R')\n\tfor i in range(len(lst)):\n\t\tif lst[i] == 'R':\n\t\t\tif max < count:\n\t\t\t\tmax = count\n\t\t\tcount = 0\n\t\telse:\n\t\t\tcount += 1\n\tprint(max + 1)\n", "t = int(input())\nfor test in range(t):\n\ts = input()\n\tr = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(len(s) + 1)\n\tmaximum = 0\n\tfor i in range(1, len(r)):\n\t\tmaximum = max(maximum, r[i] - r[i - 1])\n\tprint(maximum)\n", "from math import ceil, gcd\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom array import array\nfrom collections import Counter as ctr\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef arr(a):\n\treturn array('i', a)\n\ndef solve():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\tb = s.split('R')\n\t\tprint(max((len(x) for x in b)) + 1)\nsolve()\n", "t = int(input())\nfor i in range(1, t + 1, 1):\n\ts = input().split('R')\n\tprint(len(max(s)) + 1)\n", "def get_longest(s):\n\tc = 0\n\tm = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > m:\n\t\t\t\tm = c\n\t\t\tc = 0\n\tif c > m:\n\t\tm = c\n\treturn m\nt = int(input())\nwhile t:\n\tz = input()\n\tif 'R' not in z:\n\t\tprint(len(z) + 1)\n\telif 'L' not in z:\n\t\tprint(1)\n\telse:\n\t\tr = get_longest(z)\n\t\tprint(r + 1)\n\tt -= 1\n", "for _ in range(int(input())):\n\ts = input().strip() + 'R'\n\tn = len(s)\n\tdr = -1\n\td = 0\n\tfor (i, j) in enumerate(s):\n\t\tif j == 'R':\n\t\t\td = max(d, i - dr)\n\t\t\tdr = i\n\tprint(d)\n", "for _ in range(int(input())):\n\tstring = input()\n\tlis = string.split('R')\n\tmaxi = 0\n\tfor i in lis:\n\t\tif maxi < len(i):\n\t\t\tmaxi = len(i)\n\tprint(maxi + 1)\n", "for _ in range(int(input())):\n\ts = list(input())\n\td = 0\n\tr = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(len(s) + 1)\n\tfor i in range(1, len(r)):\n\t\tif r[i] - r[i - 1] > d:\n\t\t\td = r[i] - r[i - 1]\n\tprint(d)\n", "a = int(input())\nfor p in range(a):\n\tflag = 0\n\th = 0\n\tc = input()\n\tb = len(c)\n\tfor i in range(b):\n\t\tif c[i] == 'L':\n\t\t\tflag = flag + 1\n\t\telse:\n\t\t\tif flag >= h:\n\t\t\t\th = flag\n\t\t\tflag = 0\n\tprint(max(h + 1, flag + 1))\n", "def main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\trl = [0]\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\trl += [i + 1]\n\t\trl += [len(s) + 1]\n\t\tans = 0\n\t\tfor i in range(len(rl) - 1):\n\t\t\tans = max(ans, rl[i + 1] - rl[i])\n\t\tprint(ans)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\ti = 0\n\tm = 0\n\tk = 0\n\twhile i < n:\n\t\tif s[i] == 'L':\n\t\t\tm = m + 1\n\t\t\tk = max(m, k)\n\t\telse:\n\t\t\tm = 0\n\t\t\tk = max(m, k)\n\t\ti = i + 1\n\tprint(k + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 0\n\tl = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, l + 1)\n\t\t\tl = 0\n\t\tif s[i] == 'L':\n\t\t\tl += 1\n\tans = max(ans, l + 1)\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt = t - 1\n\ts = input()\n\tn = len(s)\n\ti = 0\n\tans = 0\n\twhile i < n:\n\t\tif s[i] == 'L':\n\t\t\tc = 1\n\t\t\tj = i + 1\n\t\t\twhile j < n and s[j] == 'L':\n\t\t\t\tc = c + 1\n\t\t\t\tj = j + 1\n\t\t\tans = max(ans, c)\n\t\t\ti = j\n\t\telse:\n\t\t\ti = i + 1\n\tprint(ans + 1)\n", "t = int(input())\nfor j in range(t):\n\ts = input()\n\tcount = 0\n\tmax_l = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tmax_l.append(count)\n\t\t\tcount = 0\n\tmax_l.append(count)\n\tif max(max_l) == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(max(max_l) + 1)\n", "num_inp = lambda : int(input())\narr_inp = lambda : list(map(int, input().split()))\nsp_inp = lambda : map(int, input().split())\nstr_inp = lambda : input()\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tk = s.split('R')\n\tprint(len(max(k)) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 1\n\tc = 1\n\tn = len(s)\n\tfor i in range(n - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tif c > ans:\n\t\t\t\tans = c\n\t\t\tc = 1\n\t\telse:\n\t\t\tc = c + 1\n\tif c > ans:\n\t\tans = c\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\tif s.count('R') == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tl = []\n\t\tl.append(0)\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tl.append(i + 1)\n\t\tl.append(len(s) + 1)\n\t\tmax = 0\n\t\tfor i in range(len(l) - 1):\n\t\t\tif l[i + 1] - l[i] > max:\n\t\t\t\tmax = l[i + 1] - l[i]\n\t\tprint(max)\n", "for _ in range(int(input())):\n\ts = input()\n\ts += 'R'\n\tn = len(s)\n\tc = 0\n\tl = []\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tl.append(c)\n\t\t\tc = 0\n\tif len(l) == 0:\n\t\tprint('1')\n\telse:\n\t\tprint(max(l) + 1)\n", "t = int(input())\nfor k in range(t):\n\ta = []\n\ts = input()\n\tn = len(s)\n\ti = 0\n\tcount = 0\n\twhile i < n:\n\t\tcount = 0\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\t\tj = i + 1\n\t\t\twhile j < n:\n\t\t\t\tif s[j] == 'L':\n\t\t\t\t\tcount += 1\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\t\tj += 1\n\t\t\ta.append(count)\n\t\t\ti = j\n\t\telif s[i] == 'R':\n\t\t\ti = i + 1\n\tif len(a) == 0:\n\t\tprint(1)\n\t\tcontinue\n\tans = max(a)\n\tprint(ans + 1)\n", "t = int(input())\nfor i in range(t):\n\tch = input()\n\tL = [len(j) for j in ch.split('R')]\n\tprint(max(L) + 1)\n", "def length(string):\n\tmaxl = 0\n\tl = 0\n\tfor ele in string:\n\t\tif ele == 'R':\n\t\t\tl = 0\n\t\telse:\n\t\t\tl += 1\n\t\tmaxl = max(l, maxl)\n\tprint(maxl + 1)\nt = int(input())\nstringarr = [None for i in range(t)]\nfor i in range(t):\n\tstringarr[i] = input()\nfor i in range(t):\n\tlength(stringarr[i])\n", "n = int(input())\nl = []\nfor i in range(n):\n\tch = input('')\n\tl.append(ch)\nfor ch in l:\n\tc = []\n\tn = len(ch)\n\tif n == 1:\n\t\tif ch[0] == 'R':\n\t\t\tprint(1)\n\t\telse:\n\t\t\tprint(2)\n\telse:\n\t\ti = 0\n\t\twhile i < n - 1:\n\t\t\tj = i\n\t\t\twhile j < n - 1 and ch[j] == 'L':\n\t\t\t\tif ch[j] == ch[j + 1]:\n\t\t\t\t\tj = j + 1\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\tif j == i:\n\t\t\t\ti = i + 1\n\t\t\telse:\n\t\t\t\tc.append(j - i + 1)\n\t\t\t\ti = j\n\t\tif c != []:\n\t\t\tprint(max(c) + 1)\n\t\telif 'L' not in ch:\n\t\t\tprint(1)\n\t\telse:\n\t\t\tif ch[0] == 'R':\n\t\t\t\tprint(2)\n\t\t\tif ch[0] == 'L':\n\t\t\t\tprint(2)\n", "testcases = int(input())\nfor i in range(testcases):\n\tdirections = list(input())\n\tarr = [-1]\n\tif 'R' not in directions:\n\t\tprint(len(directions) + 1)\n\telse:\n\t\tfor i in range(len(directions)):\n\t\t\tif directions[i] == 'R':\n\t\t\t\tarr.append(i)\n\t\tarr.append(len(directions))\n\t\td = 0\n\t\tfor i in range(len(arr) - 1):\n\t\t\tif abs(arr[i] - arr[i + 1]) > d:\n\t\t\t\td = abs(arr[i] - arr[i + 1])\n\t\tprint(d)\n", "for _ in range(int(input())):\n\ts = input()\n\tprev = -1\n\td = 0\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\td = max(d, i - prev)\n\t\t\tprev = i\n\tif d == 0:\n\t\tprint(n + 1)\n\telse:\n\t\td = max(d, n - prev)\n\t\tprint(d)\n", "for i in range(int(input())):\n\tprint(1 + max(map(len, input().split('R'))))\n", "def helper(s):\n\tif 'R' not in s:\n\t\treturn len(s) + 1\n\tminl = 1\n\tcounter = 1\n\ts = 'R' + s\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'L':\n\t\t\tcounter += 1\n\t\telse:\n\t\t\tif minl < counter:\n\t\t\t\tminl = counter\n\t\t\tcounter = 1\n\treturn minl\nT = int(input())\nfor i in range(T):\n\ts = input()\n\tprint(helper(s))\n", "t = int(input())\nfor y in range(t):\n\ts = input()\n\tct = 0\n\tans = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tct += 1\n\t\telse:\n\t\t\tans = max(ans, ct)\n\t\t\tct = 0\n\tprint(max(ans, ct) + 1)\n", "inps = int(input())\nres = []\ncount = 0\ncounts = []\nfor i in range(inps):\n\tx = input()\n\tfor i in x:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcounts.append(count)\n\t\t\tcount = 0\n\tif 'R' not in x:\n\t\tcounts.append(count)\n\t\tcount = 0\n\tif x[-1] == 'L':\n\t\tif count > sorted(counts)[-1]:\n\t\t\tcounts.append(count)\n\t\tcount = 0\n\tans_arr = sorted(counts)\n\tans = ans_arr[-1] + 1\n\tres.append(ans)\n\tcounts = []\nfor i in res:\n\tprint(i)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = list(input().rstrip())\n\t(c, m) = (0, 0)\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\t\tm = max(m, c)\n\tans = m + 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tstr = input()\n\tcount = 0\n\tleng = len(str)\n\tif str.count('R') == leng:\n\t\tprint(1)\n\t\tcontinue\n\tif str.count('L') == leng:\n\t\tprint(leng + 1)\n\t\tcontinue\n\ti = 0\n\tmaxcount = 0\n\twhile i < leng:\n\t\tcount = 0\n\t\twhile i < leng and str[i] == 'L':\n\t\t\tcount += 1\n\t\t\ti += 1\n\t\t\tif maxcount < count:\n\t\t\t\tmaxcount = count\n\t\ti += 1\n\tprint(maxcount + 1)\n", "test_cases = int(input())\ntest = test_cases\ndata = []\nwhile test_cases > 0:\n\tdata.append(input())\n\ttest_cases -= 1\nfor i in range(0, test):\n\tdummy = [0]\n\tfor j in range(0, len(data[i])):\n\t\tif data[i][j] == 'R':\n\t\t\tdummy.append(j + 1)\n\tdummy.append(len(data[i]) + 1)\n\tans = 0\n\tfor k in range(0, len(dummy) - 1):\n\t\tans = max(ans, dummy[k + 1] - dummy[k])\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tnum = 0\n\tans = 1\n\tfor i in s:\n\t\tnum = (num + 1) * (i == 'L')\n\t\tans = max(ans, num + 1)\n\tprint(ans)\n", "from sys import stdin\ninp = stdin.readline\nt = int(inp().strip())\nfor _ in range(t):\n\ta = ['R']\n\ta.extend(list(inp().strip()))\n\ta.append('R')\n\tmaxDist = -1\n\tdist = 0\n\tfor i in a:\n\t\tif i == 'R':\n\t\t\tmaxDist = max(maxDist, dist)\n\t\t\tdist = 0\n\t\telse:\n\t\t\tdist += 1\n\tprint(maxDist + 1)\n", "for _ in range(int(input())):\n\tword = input()\n\tn = len(word)\n\tif 'R' not in word:\n\t\tprint(n + 1)\n\telse:\n\t\ttemp = [0]\n\t\tfor i in range(n):\n\t\t\tif word[i] == 'R':\n\t\t\t\ttemp.append(i + 1)\n\t\ttemp.append(n + 1)\n\t\tans = []\n\t\tfor i in range(len(temp) - 1):\n\t\t\tt = temp[i + 1] - temp[i]\n\t\t\tans.append(t)\n\t\tans.sort()\n\t\tprint(ans[-1])\n", "for _ in range(int(input())):\n\ts = input()\n\ta = []\n\tl = len(s)\n\tfor i in range(0, l):\n\t\tif s[i] == 'R':\n\t\t\ta.append(i)\n\tif len(a) == 0:\n\t\tprint(l + 1)\n\telif len(a) == 1:\n\t\tprint(max(a[0] + 1, l - a[0]))\n\telse:\n\t\tm = 0\n\t\tfor i in range(0, len(a) - 1):\n\t\t\tif a[i + 1] - a[i] > m:\n\t\t\t\tm = a[i + 1] - a[i]\n\t\tprint(max(m, a[0] + 1, l - a[-1]))\n", "def dsw(frase):\n\tlista = [0]\n\tans = 0\n\tfor i in range(len(frase)):\n\t\tif frase[i] == 'R':\n\t\t\tlista.append(i + 1)\n\tlista.append(len(frase) + 1)\n\tfor i in range(1, len(lista)):\n\t\tans = max(ans, lista[i] - lista[i - 1])\n\treturn ans\ninp = int(input())\nwhile inp:\n\tfrase = str(input())\n\tprint(dsw(frase))\n\tinp -= 1\n", "for _ in range(int(input())):\n\tl = list(input())\n\tindex = [i + 1 for (i, letter) in enumerate(l) if letter == 'R']\n\tindex.insert(0, 0)\n\tindex.append(len(l) + 1)\n\tans = 0\n\tfor i in range(len(index) - 1):\n\t\tans = max(ans, index[i + 1] - index[i])\n\tprint(ans)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n\ndef chk(s, d):\n\tn = len(s)\n\tmx = d - 1\n\tfor i in range(n):\n\t\tif i > mx:\n\t\t\treturn False\n\t\tif s[i] == 'L':\n\t\t\tcontinue\n\t\tmx = i + d\n\treturn mx >= n\n\ndef main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\t(l, r) = (0, len(s) + 2)\n\t\twhile r - l > 1:\n\t\t\tm = (l + r) // 2\n\t\t\tif chk(s, m):\n\t\t\t\tr = m\n\t\t\telse:\n\t\t\t\tl = m\n\t\tprint(r)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "for i in range(int(input())):\n\tx = input()\n\tj = len(x)\n\ti = j - 1\n\tmx = 0\n\twhile i >= 0:\n\t\tif x[i] == 'R':\n\t\t\tmx = max(j - i, mx)\n\t\t\tj = i\n\t\ti -= 1\n\tmx = max(j + 1, mx)\n\tprint(mx)\n", "k = int(input())\nfor w in range(k):\n\tjumps = input()\n\tminRight = 1\n\tcount = 1\n\tfor i in jumps:\n\t\tif i == 'R':\n\t\t\tif count > minRight:\n\t\t\t\tminRight = count\n\t\t\tcount = 1\n\t\telse:\n\t\t\tcount += 1\n\tif count > minRight:\n\t\tminRight = count\n\tprint(minRight)\n", "for _ in range(int(input())):\n\ts = list(input().strip())\n\tm = 0\n\ttemp = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max(m, i - temp)\n\t\t\ttemp = i\n\tm = max(m, len(s) - temp)\n\tprint(m)\n", "b = int(input())\nc = []\nh = []\ng = 0\nfor i in range(b):\n\tc = []\n\tg = 0\n\ta = input()\n\tfor i in range(len(a)):\n\t\tif a[i] == 'L':\n\t\t\tg += 1\n\t\telse:\n\t\t\tc.append(g)\n\t\t\tg = 0\n\tc.append(g)\n\th.append(max(c))\nfor i in range(b):\n\tprint(h[i] + 1)\n", "for _ in range(int(input())):\n\tstring = list(input())\n\tstring.append('R')\n\tcount = 0\n\tanswer = []\n\tfor i in string:\n\t\tif i == 'R':\n\t\t\tcount += 1\n\t\t\tanswer.append(count)\n\t\t\tcount = 0\n\t\telse:\n\t\t\tcount += 1\n\tprint(max(answer))\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tli = list(input())\n\td = 0\n\ti = 0\n\tlast = 0\n\tj = 0\n\tfor x in li:\n\t\tj += 1\n\t\tif x == 'L':\n\t\t\ti += 1\n\t\telse:\n\t\t\ti += 1\n\t\t\tlast = j\n\t\t\td = max(d, i)\n\t\t\ti = 0\n\tprint(max(d, len(li) + 1 - last))\n", "nn = int(input())\nfor i in range(nn):\n\tl = input()\n\tl += 'R'\n\tn = len(l) - 1\n\tj = -1\n\tcou = 1\n\tfor i in range(n + 1):\n\t\tif l[i] == 'L':\n\t\t\tcou += 1\n\t\telse:\n\t\t\tj = max(j, cou)\n\t\t\tcou = 1\n\tj = max(j, cou)\n\tprint(j)\n", "from sys import stdin\n\ndef solve(s):\n\tans = 0\n\ttemp = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tans = max(ans, temp)\n\t\t\ttemp = 0\n\tans = max(ans, temp) + 1\n\tprint(ans)\n\ndef main():\n\tinp = stdin.readline\n\tfor _ in range(int(inp())):\n\t\ts = inp().strip()\n\t\tsolve(s)\nmain()\n", "def answer(s):\n\tcount = 0\n\tmax_count = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\t\tif count > max_count:\n\t\t\t\tmax_count = count\n\t\telse:\n\t\t\tcount = 0\n\treturn max_count + 1\n\ndef main():\n\tt = int(input())\n\ts = [0] * t\n\tfor j in range(t):\n\t\ts[j] = input()\n\tfor j in range(t):\n\t\tprint(answer(s[j]))\nmain()\n", "import math, sys\nfrom collections import Counter, defaultdict, deque\nfrom sys import stdin, stdout\ninput = stdin.readline\nli = lambda : list(map(int, input().split()))\n\ndef case():\n\ta = input().strip()\n\tc = 0\n\tm = 0\n\ti = 0\n\twhile i < len(a):\n\t\tif a[i] == 'L':\n\t\t\tif i == 0:\n\t\t\t\tc += 1\n\t\t\telif a[i] == 'L':\n\t\t\t\tc += 1\n\t\t\telse:\n\t\t\t\tc += 2\n\t\t\tm = max(m, c)\n\t\telse:\n\t\t\tc = 0\n\t\ti += 1\n\tprint(m + 1)\nfor _ in range(int(input())):\n\tcase()\n", "for _ in range(int(input())):\n\ts = input()\n\tminn = 1\n\ts = 'R' + s + 'R'\n\tre = 0\n\td = True\n\tfor i in range(1, len(s)):\n\t\tif s[i] != s[i - 1]:\n\t\t\tif s[i] == 'L':\n\t\t\t\tre = i - 1\n\t\t\t\td = True\n\t\t\tif s[i] == 'R' and d:\n\t\t\t\td = False\n\t\t\t\tminn = max(minn, i - re)\n\t\telif s[i] == 'R':\n\t\t\tre = i - 1\n\tprint(minn)\n", "t = int(input())\nfor k in range(t):\n\ts = input()\n\tans = 0\n\tflag = 0\n\tcount = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telif s[i] == 'R':\n\t\t\tans = max(ans, count)\n\t\t\tcount = 0\n\tans = max(ans, count)\n\tprint(ans + 1)\n", "import re\nT = int(input())\nfor t in range(T):\n\tstring = 'R' + input() + 'R'\n\tmax_gap = max([len(gap) for gap in string.split('R')])\n\tprint(max_gap + 1)\n", "from math import *\n\ndef binarySearch(arr, x, i):\n\tl = i\n\tr = len(arr) - 1\n\twhile l <= r:\n\t\tmid = (l + r) // 2\n\t\tif arr[mid] == x:\n\t\t\treturn mid\n\t\telif arr[mid] < x:\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid - 1\n\treturn -1\n\ndef js(arr, x):\n\tl = 0\n\tr = len(arr) - 1\n\tans = -1\n\twhile l <= r:\n\t\tm = (l + r) // 2\n\t\tif arr[m] <= x:\n\t\t\tans = m\n\t\t\tl = m + 1\n\t\telse:\n\t\t\tr = m - 1\n\treturn ans\n\ndef jg(arr, x):\n\tl = 0\n\tr = len(arr) - 1\n\tans = -1\n\twhile l <= r:\n\t\tm = (l + r) // 2\n\t\tif arr[m] >= x:\n\t\t\tans = m\n\t\t\tr = m - 1\n\t\telse:\n\t\t\tl = m + 1\n\treturn ans\nfor __ in range(int(input())):\n\ts = input()\n\ts += 'R'\n\tc = 0\n\tx = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif c < i - x:\n\t\t\t\tc = i - x\n\t\t\tx = i\n\tprint(c)\n", "def process(A):\n\tn = len(A)\n\tcurr = -1\n\tanswer = 0\n\tfor i in range(n):\n\t\tif A[i] == 'R':\n\t\t\tanswer = max(answer, i - curr)\n\t\t\tcurr = i\n\tanswer = max(answer, n - curr)\n\treturn answer\nt = int(input())\nfor i in range(t):\n\tA = input()\n\tprint(process(A))\n", "t = int(input())\nfor tt in range(t):\n\ts = input()\n\trpos = []\n\trpos.append(-1)\n\tfor x in range(len(s)):\n\t\tif s[x] == 'R':\n\t\t\trpos.append(x)\n\trpos.append(len(s))\n\tmx = 0\n\tfor i in range(1, len(rpos)):\n\t\tmx = max(mx, rpos[i] - rpos[i - 1])\n\tprint(mx)\n", "for _ in range(int(input())):\n\ts = 'R' + input() + 'R'\n\tif set(s) == 'R':\n\t\tprint(1)\n\t\tcontinue\n\telse:\n\t\tl = []\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tl.append(i)\n\t\tmx = l[1] - l[0]\n\t\tfor i in range(2, len(l)):\n\t\t\tmx = max(mx, l[i] - l[i - 1])\n\t\tprint(mx)\n", "n = int(input())\n\ndef f(a):\n\tif not a:\n\t\treturn 1\n\tprev = 0\n\tres = 1\n\tfor (i, c) in enumerate(a, 1):\n\t\tif c == 'R':\n\t\t\tres = max(res, i - prev)\n\t\t\tprev = i\n\tres = max(res, len(a) + 1 - prev)\n\treturn res\nfor i in range(n):\n\tprint(f(input()))\n", "n = int(input())\n\ndef min_dist(s):\n\tmax_count = 0\n\tcount = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tcount = 0\n\t\telse:\n\t\t\tcount += 1\n\t\t\tif max_count < count:\n\t\t\t\tmax_count = count\n\treturn max_count + 1\nfor i in range(n):\n\ts = input()\n\tprint(min_dist(s))\n", "def R():\n\treturn map(int, input().split())\n\ndef I():\n\treturn int(input())\n\ndef S():\n\treturn str(input())\n\ndef L():\n\treturn list(R())\nfrom collections import Counter\nimport math\nimport sys\nfrom itertools import permutations\nimport bisect\nfor _ in range(I()):\n\ts = 'R' + S() + 'R'\n\tl = len(s)\n\tlast = -1\n\tmaxj = -1\n\tfor i in range(l):\n\t\tif s[i] == 'R':\n\t\t\tif last > -1:\n\t\t\t\tmaxj = max(maxj, i - last)\n\t\t\tlast = i\n\tprint(maxj)\n", "x = int(input())\nfor i in range(x):\n\tcadeiaL = 0\n\tflag = False\n\tstring = str(input())\n\tmaior = 0\n\tfor i in range(len(string)):\n\t\tif string[i] == 'L':\n\t\t\tflag = True\n\t\t\tcadeiaL += 1\n\t\telse:\n\t\t\tif cadeiaL > maior:\n\t\t\t\tmaior = cadeiaL\n\t\t\tflag = False\n\t\t\tcadeiaL = 0\n\tif cadeiaL > maior:\n\t\tmaior = cadeiaL\n\tprint(maior + 1)\n", "t = int(input())\nfor te in range(t):\n\ta = input()\n\tv = []\n\tans = 0\n\tv.append(0)\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tv.append(i + 1)\n\tv.append(len(a) + 1)\n\tfor i in range(len(v) - 1):\n\t\tans = max(ans, v[i + 1] - v[i])\n\tprint(ans)\n", "e = ''\nfor i in range(int(input())):\n\ts = input() + 'R'\n\ti = 0\n\t(c, d) = (0, 0)\n\twhile i < len(s):\n\t\tif s[i] == 'R':\n\t\t\td = max(c, d)\n\t\t\tc = 0\n\t\telse:\n\t\t\tc += 1\n\t\ti += 1\n\te += str(d + 1) + '\\n'\nprint(e)\n", "t = int(input())\nfor _ in range(t):\n\ts = input().strip()\n\tm = 0\n\tcount = 0\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > m:\n\t\t\t\tm = count\n\t\t\tcount = 0\n\tif count > m:\n\t\tm = count\n\tprint(m + 1)\n", "import math\n\nclass Read:\n\n\t@staticmethod\n\tdef string():\n\t\treturn input()\n\n\t@staticmethod\n\tdef int():\n\t\treturn int(input())\n\n\t@staticmethod\n\tdef list(sep=' '):\n\t\treturn input().split(sep)\n\n\t@staticmethod\n\tdef list_int(sep=' '):\n\t\treturn list(map(int, input().split(sep)))\nresult = math.inf\n\ndef solve():\n\ts = Read.string()\n\ta = []\n\tt = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\ta.append(t)\n\t\t\tt = 0\n\t\telse:\n\t\t\tt += 1\n\ta.append(t)\n\tprint(max(a) + 1)\nquery_count = Read.int()\nwhile query_count:\n\tquery_count -= 1\n\tsolve()\n", "for _ in range(int(input())):\n\ts = input()\n\tmax_l_len = 0\n\tl_len = 0\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tl_len += 1\n\t\telse:\n\t\t\tmax_l_len = max(max_l_len, l_len)\n\t\t\tl_len = 0\n\tmax_l_len = max(max_l_len, l_len)\n\tprint(max_l_len + 1)\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\nt = int(input())\nfor _ in range(t):\n\tS = input()\n\tans = 0\n\tcur = 0\n\tfor s in S:\n\t\tif s == 'L':\n\t\t\tcur += 1\n\t\telse:\n\t\t\tans = max(ans, cur)\n\t\t\tcur = 0\n\telse:\n\t\tans = max(ans, cur)\n\tprint(ans + 1)\n", "import sys\nimport math\nimport collections\nimport operator as op\nfrom collections import deque\nfrom math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor\nfrom bisect import bisect_right, bisect_left, bisect\nfrom functools import reduce\nfrom sys import stdin, stdout, setrecursionlimit\nsetrecursionlimit(2 ** 20)\n\ndef ncr(n, r):\n\tr = min(r, n - r)\n\tnumer = reduce(op.mul, range(n, n - r, -1), 1)\n\tdenom = reduce(op.mul, range(1, r + 1), 1)\n\treturn numer // denom\n\ndef prime_factors(n):\n\ti = 2\n\tfactors = []\n\twhile i * i <= n:\n\t\tif n % i:\n\t\t\ti += 1\n\t\telse:\n\t\t\tn //= i\n\t\t\tfactors.append(i)\n\tif n > 1:\n\t\tfactors.append(n)\n\treturn list(factors)\n\ndef sumDigits(no):\n\treturn 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))\nMOD = 1000000007\nPMOD = 998244353\nN = 10 ** 9 + 7\nLOGN = 30\nT = 1\nT = int(stdin.readline())\nfor _ in range(T):\n\ts = list(stdin.readline().strip('\\n'))\n\tl = []\n\tmx = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tl.append(s[i])\n\t\telse:\n\t\t\tl = []\n\t\tmx = max(len(l), mx)\n\tprint(mx + 1)\n", "n = int(input())\nfor k in range(n):\n\tS = 'R' + input() + 'R'\n\ttmp = 0\n\tlast = 0\n\tfor i in range(1, len(S)):\n\t\tif S[i] == 'R':\n\t\t\tt = i - last\n\t\t\tif t > tmp:\n\t\t\t\ttmp = t\n\t\t\tlast = i\n\tprint(tmp)\n", "t = int(input())\na = []\nfor i in range(t):\n\ta.append(input())\nfor i in a:\n\tprint(len(max(i.split('R'))) + 1)\n", "def answer(jumpArr):\n\tjumpArr = 'R' + jumpArr + 'R'\n\tLs = []\n\tRindex = -1\n\tfor i in range(0, len(jumpArr)):\n\t\tif jumpArr[i] == 'R':\n\t\t\tLs.append(i - Rindex)\n\t\t\tRindex = i\n\tif len(Ls) == 0:\n\t\tLs.append(1)\n\treturn max(Ls)\ntestCount = int(input())\ntestCases = []\nfor _ in range(0, testCount):\n\ttestCases.append(str(input()))\nfor i in range(0, len(testCases)):\n\tprint(answer(testCases[i]))\n", "n = int(input())\nans = []\nfor i in range(n):\n\ts = 'R' + input() + 'R'\n\tR = []\n\tlast_R = 0\n\tmaxx = -1\n\tL = []\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tR.append(i)\n\t\t\tif i - last_R > maxx:\n\t\t\t\tmaxx = i - last_R\n\t\t\tlast_R = i\n\t\telse:\n\t\t\tL.append(i)\n\tif maxx == -1:\n\t\tmaxx = len(s)\n\tans.append(maxx)\nprint(*ans, sep='\\n')\n", "n = int(input())\nt = 0\nwhile t < n:\n\tarray = []\n\tstring = input()\n\tfor i in string:\n\t\tarray.append(i)\n\tadd = 0\n\tmini = 0\n\tfor i in array:\n\t\tif i == 'L':\n\t\t\tadd += 1\n\t\telse:\n\t\t\tmini = max(mini, add)\n\t\t\tadd = 0\n\tmini = max(mini, add)\n\tprint(mini + 1)\n\tt += 1\n", "for _ in range(int(input())):\n\ta = input()\n\ta = 'R' + a + 'R'\n\tss = 0\n\tj = -1\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tss = max(ss, i - j)\n\t\t\tj = i\n\tprint(ss)\n", "for _ in range(int(input())):\n\tstring = input().strip()\n\tn = len(string)\n\tans = -1\n\tprev = n\n\tfor i in range(n - 1, -2, -1):\n\t\tif i == -1:\n\t\t\tans = max(prev - -1, ans)\n\t\t\tcontinue\n\t\tif string[i] == 'R':\n\t\t\tans = max(prev - i, ans)\n\t\t\tprev = i\n\tif ans == -1:\n\t\tans = n + 1\n\tprint(ans)\n", "for j in range(int(input())):\n\tw = 0\n\tz = input()\n\ta = []\n\tb = 1\n\tfor j in z:\n\t\tif j == 'L':\n\t\t\tb += 1\n\t\telse:\n\t\t\tif b:\n\t\t\t\ta.append(b)\n\t\t\tb = 1\n\tif b:\n\t\ta.append(b)\n\tprint(max(a))\n", "for _ in [0] * int(input()):\n\ts = input()\n\t(otvet, last_R) = (0, -1)\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\totvet = len(s) - i\n\t\t\tlast_R = i\n\t\t\tbreak\n\tif last_R == -1:\n\t\totvet = len(s) + 1\n\tnew_max = 2 if s[0] == 'L' else 1\n\tnewotvet = new_max\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tnew_max += 1\n\t\t\tnewotvet = max(newotvet, new_max)\n\t\telse:\n\t\t\tnew_max = 1\n\tprint(max(newotvet, otvet))\n", "from math import ceil\nfor _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tl = s.count('L')\n\tr = s.count('R')\n\tif r == 0:\n\t\tprint(n + 1)\n\telif l == 0:\n\t\tprint(1)\n\telse:\n\t\tb = [0]\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tb.append(i + 1)\n\t\tb.append(len(s) + 1)\n\t\tk = []\n\t\tfor i in range(1, len(b)):\n\t\t\tk.append(b[i] - b[i - 1])\n\t\tprint(max(k))\n", "t = int(input())\nwhile t > 0:\n\ts = input()\n\tleft = 0\n\tright = 0\n\tmid = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tleft = i + 1\n\t\t\tbreak\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tright = len(s) - i\n\t\t\tbreak\n\tprev = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif prev == -1:\n\t\t\t\tprev = i\n\t\t\telse:\n\t\t\t\tmid = max(mid, i - prev)\n\t\t\t\tprev = i\n\tif left == 0:\n\t\tprint(len(s) + 1)\n\telif mid != 0:\n\t\tprint(max(left, right, mid))\n\telse:\n\t\tprint(max(left, right))\n\tt -= 1\n", "t = int(input())\nfor _ in range(t):\n\ta = input().split('R')\n\tm = 0\n\tfor i in a:\n\t\tif len(i) + 1 > m:\n\t\t\tm = len(i) + 1\n\tprint(m)\n", "def frogs(string):\n\tstring = 'R' + string + 'R'\n\tres = 0\n\tleft = 0\n\tfor i in range(len(string)):\n\t\tif string[i] == 'R':\n\t\t\tres = max(res, i - left)\n\t\t\tleft = i\n\treturn res\nfor _ in range(int(input())):\n\tstring = input()\n\tprint(frogs(string))\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tconsec = 0\n\tbiggest = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tconsec = 0\n\t\telse:\n\t\t\tconsec += 1\n\t\tif consec > biggest:\n\t\t\tbiggest = consec\n\tprint(biggest + 1)\n", "for _ in range(int(input())):\n\tx = input()\n\tc = 0\n\tm = 0\n\tfor i in x:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > m:\n\t\t\t\tm = c\n\t\t\tc = 0\n\tif c > m:\n\t\tm = c\n\tprint(m + 1)\n", "t = int(input())\nall_res = []\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tdiff = [0] + [i + 1 for i in range(n) if s[i] == 'R'] + [n + 1]\n\tres = max([diff[i + 1] - diff[i] for i in range(len(diff) - 1)])\n\tall_res.append(str(res))\nprint('\\n'.join(all_res))\n", "import sys\nT = int(input())\nt = 0\nwhile t < T:\n\tL = input()\n\tconta = 0\n\tout = 0\n\tfor c in L:\n\t\tif c == 'R':\n\t\t\tif conta > out:\n\t\t\t\tout = conta\n\t\t\tconta = 0\n\t\telse:\n\t\t\tconta += 1\n\tif conta > out:\n\t\tout = conta\n\tprint(out + 1)\n\tt += 1\n", "t = int(input())\nfor i in range(t):\n\tstring = input()\n\tresp = 0\n\tlista = [0]\n\tfor j in range(len(string)):\n\t\tif string[j] == 'R':\n\t\t\tlista.append(j + 1)\n\tlista.append(len(string) + 1)\n\tfor j in range(1, len(lista)):\n\t\taux = lista[j] - lista[j - 1]\n\t\tresp = max(resp, aux)\n\tprint(resp)\n", "testcases = int(input())\nfor testcase in range(testcases):\n\tgetstring = str(input())\n\tgetlen = len(getstring)\n\tdicts = {}\n\tgetRindex = []\n\tindex = 0\n\tfor i in getstring:\n\t\tindex += 1\n\t\tif i == 'R':\n\t\t\tgetRindex.append(index)\n\tif len(getRindex) == 0:\n\t\tprint(getlen + 1)\n\t\tcontinue\n\tgetRindex.insert(0, 0)\n\tgetRindex.append(getlen + 1)\n\tmaxdiff = 0\n\tgetrarrlen = len(getRindex)\n\tfor i in range(1, getrarrlen):\n\t\tmaxdiff = max(maxdiff, getRindex[i] - getRindex[i - 1])\n\tprint(maxdiff)\n", "def ok(x):\n\ti = -1\n\twhile i < n:\n\t\tif i + x >= n:\n\t\t\treturn True\n\t\tb = False\n\t\tfor j in range(1, x + 1):\n\t\t\tif s[i + j] == 'R':\n\t\t\t\ti += j\n\t\t\t\tb = True\n\t\t\t\tbreak\n\t\tif b == False:\n\t\t\treturn False\nt = int(input())\nwhile t > 0:\n\ts = list(input())\n\tn = len(s)\n\tlb = 1\n\trb = n + 1\n\twhile lb < rb:\n\t\tmb = (lb + rb) // 2\n\t\tif ok(mb):\n\t\t\trb = mb\n\t\telse:\n\t\t\tlb = mb + 1\n\tprint(lb)\n\tt -= 1\n", "for i in range(int(input())):\n\tdata = 'R' + input() + 'R'\n\tmaxDist = 1\n\tlast = 0\n\tfor i in range(1, len(data)):\n\t\tif data[i] == 'R':\n\t\t\tmaxDist = max(maxDist, i - last)\n\t\t\tlast = i\n\tprint(maxDist)\n", "t = int(input())\nfor i in range(0, t):\n\tst = input()\n\tst = 'R' + st + 'R'\n\tdist = 0\n\tref = 0\n\tfor i in range(1, len(st)):\n\t\tif st[i] == 'R':\n\t\t\tif i - ref >= dist:\n\t\t\t\tdist = i - ref\n\t\t\tref = i\n\tprint(dist)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tif s.count('R') == 0:\n\t\tprint(len(s) + 1)\n\telif s.count('L') == 0:\n\t\tprint(1)\n\telse:\n\t\td = 1\n\t\tinternal = 1\n\t\tfor cell in s:\n\t\t\tif cell == 'R':\n\t\t\t\tinternal = 1\n\t\t\telse:\n\t\t\t\tinternal += 1\n\t\t\td = max(internal, d)\n\t\tprint(d)\n", "import sys\nreader = (s.rstrip() for s in sys.stdin)\ninput = reader.__next__\n\ndef gift():\n\tfor _ in range(t):\n\t\tstring = input()\n\t\tn = len(string)\n\t\tmaxdis = 0\n\t\tprevR = 0\n\t\tfor i in range(n):\n\t\t\tif string[i] == 'R':\n\t\t\t\tcurrdis = i + 1 - prevR\n\t\t\t\tmaxdis = max(maxdis, currdis)\n\t\t\t\tprevR = i + 1\n\t\t\telif i == n - 1:\n\t\t\t\tcurrdis = n + 1 - prevR\n\t\t\t\tmaxdis = max(maxdis, currdis)\n\t\tyield maxdis\nt = int(input())\nans = gift()\nprint(*ans, sep='\\n')\n", "for t in range(int(input())):\n\ts = input()\n\tans = 0\n\tcount = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 0\n\t\tif count > ans:\n\t\t\tans = count\n\tprint(ans + 1)\n", "N = int(input())\nfor t in range(N):\n\ts = input()\n\tA = s.split('R')\n\tans = 0\n\tfor s in A:\n\t\tans = max(ans, len(s))\n\tprint(ans + 1)\n", "t = int(input())\nwhile t > 0:\n\tseq = input()\n\tc = 0\n\td = 0\n\tfor val in seq:\n\t\tif val == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\td = max(c, d)\n\t\t\tc = 0\n\td = max(c, d)\n\td += 1\n\tprint(d)\n\tt -= 1\n", "import sys\nread = lambda : list(map(int, sys.stdin.readline().strip().split()))\nfor _ in range(int(input())):\n\ts = input()\n\tpos = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(len(s) + 1)\n\td = 1\n\tfor i in range(len(pos) - 1):\n\t\td = max(d, pos[i + 1] - pos[i])\n\tprint(d)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tlast_r_idx = -1\n\tmaxi = float('-inf')\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmaxi = max(maxi, i - last_r_idx)\n\t\t\tlast_r_idx = i\n\tmaxi = max(maxi, len(s) - last_r_idx)\n\tprint(maxi)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tmx = 0\n\tx = 1\n\tfor ch in s:\n\t\tif ch == 'L':\n\t\t\tx += 1\n\t\telse:\n\t\t\tmx = max(mx, x)\n\t\t\tx = 1\n\tmx = max(mx, x)\n\tprint(mx)\n", "t = int(input())\nfor i in range(t):\n\ta = input()\n\tk = 0\n\tm = 0\n\tn = len(a)\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tif i + 1 - k > m:\n\t\t\t\tm = i - k + 1\n\t\t\tk = i + 1\n\tif n + 1 - k > m:\n\t\tm = n + 1 - k\n\tprint(m)\n", "for _ in range(int(input())):\n\ts = str(input())\n\t(ans, temp) = (0, 1)\n\tfor i in range(1, len(s)):\n\t\tif s[i] == s[i - 1] == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tans = max(ans, temp)\n\t\t\ttemp = 1\n\tans = max(ans, temp)\n\n\tdef allCharactersSame(s):\n\t\tn = len(s)\n\t\tfor i in range(1, n):\n\t\t\tif s[i] != s[0]:\n\t\t\t\treturn False\n\t\treturn True\n\tif allCharactersSame(s) and s[0] == 'R':\n\t\tprint(1)\n\telse:\n\t\tprint(ans + 1)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tcnt = 0\n\tans = 0\n\tflag1 = 0\n\tfor j in range(len(s)):\n\t\tif flag1:\n\t\t\tif s[j] == 'L':\n\t\t\t\tcnt += 1\n\t\t\telse:\n\t\t\t\tans = max(ans, cnt + 1)\n\t\t\t\tflag1 = 0\n\t\t\t\tcnt = 0\n\t\telif s[j] == 'L':\n\t\t\tcnt += 1\n\t\t\tflag1 = 1\n\t\telse:\n\t\t\tcnt = 0\n\tans = max(ans, cnt + 1)\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = input() + 'R'\n\tmx = -float('inf')\n\tcur = 0\n\twhile s.find('R', cur) != -1:\n\t\tnxt = s.find('R', cur)\n\t\td = nxt - cur\n\t\tif d > mx:\n\t\t\tmx = d\n\t\tcur = nxt + 1\n\tprint(mx + 1)\n", "def check(d):\n\tglobal a, s\n\tprev = 0\n\ti = 0\n\twhile prev != len(s) + 1:\n\t\twhile i < len(a) and a[i] - prev <= d:\n\t\t\ti += 1\n\t\ti -= 1\n\t\tif a[i] == prev:\n\t\t\treturn False\n\t\tprev = a[i]\n\treturn True\nfor t in range(int(input())):\n\ts = input()\n\ta = [0]\n\tfor i in range(1, len(s) + 1):\n\t\tif s[i - 1] == 'R':\n\t\t\ta.append(i)\n\ta.append(len(s) + 1)\n\tleft = 0\n\tright = len(s) + 1\n\twhile left + 1 != right:\n\t\tmid = (left + right) // 2\n\t\tif check(mid):\n\t\t\tright = mid\n\t\telse:\n\t\t\tleft = mid\n\tprint(right)\n", "import sys\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep='\\n')\n\ndef II():\n\treturn int(sys.stdin.readline())\n\ndef MI():\n\treturn map(int, sys.stdin.readline().split())\n\ndef LI():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number):\n\treturn [LI() for _ in range(rows_number)]\n\ndef SI():\n\treturn sys.stdin.readline()[:-1]\n\ndef main():\n\tt = II()\n\tfor _ in range(t):\n\t\ts = SI()\n\t\tans = 1\n\t\tw = 0\n\t\tfor c in s:\n\t\t\tif c == 'L':\n\t\t\t\tw += 1\n\t\t\telse:\n\t\t\t\tans = max(ans, w + 1)\n\t\t\t\tw = 0\n\t\tans = max(ans, w + 1)\n\t\tprint(ans)\nmain()\n", "for i in range(int(input())):\n\ta = input()\n\ta += 'R'\n\tr = -1\n\tl = []\n\tfor j in range(0, len(a)):\n\t\tif a[j] == 'R':\n\t\t\tl.append(j - r)\n\t\t\tr = j\n\tprint(max(l))\n", "from math import *\nfrom sys import *\nt = int(stdin.readline())\nfor _ in range(t):\n\ta = input()\n\tn = len(a)\n\tc = 0\n\tans = []\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tans.append(c + 1)\n\t\t\tc = 0\n\t\telse:\n\t\t\tc += 1\n\tans.append(c + 1)\n\tprint(max(ans))\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tlast_idx = -1\n\tv = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tc = i - last_idx\n\t\t\tlast_idx = i\n\t\t\tv.append(c)\n\tv.append(len(s) - last_idx)\n\tprint(max(v))\n", "for _ in range(int(input())):\n\ts = input()\n\tct1 = 0\n\tct2 = 0\n\tflag = False\n\ti = 0\n\tn = len(s)\n\tprev = 0\n\twhile i < n:\n\t\tif s[i] == 'R':\n\t\t\tct1 = max(ct1, i - prev)\n\t\t\tprev = i\n\t\ti += 1\n\tct3 = 0\n\tct1 = max(ct1, i - prev)\n\tpos = len(s) - 1\n\twhile pos >= 0 and s[pos] == 'L':\n\t\tct3 += 1\n\t\tpos -= 1\n\tpos = 0\n\tct4 = 0\n\twhile pos < n and s[pos] == 'L':\n\t\tct4 += 1\n\t\tpos += 1\n\tif ct3 == ct1 or ct1 == ct4:\n\t\tct1 += 1\n\tprint(ct1)\n", "def solve(a):\n\ta = 'R' + a\n\tn = len(a)\n\n\tdef check(m):\n\t\tlast = n\n\t\tfor i in range(n - 1, -1, -1):\n\t\t\tif a[i] == 'R':\n\t\t\t\tif last > i + m:\n\t\t\t\t\treturn False\n\t\t\t\tlast = i\n\t\treturn True if last != n else False\n\t(l, r) = (1, n + 1)\n\twhile l <= r:\n\t\tm = l + (r - l) // 2\n\t\tif check(m):\n\t\t\tr = m - 1\n\t\telse:\n\t\t\tl = m + 1\n\treturn l\nt = int(input())\nfor i in range(t):\n\ta = input()\n\tprint(solve(a))\n", "n = int(input())\nfor _ in range(n):\n\ts = input()\n\ts += 'R'\n\trights = [0] + [ind + 1 for (ind, val) in enumerate(s) if val == 'R']\n\tans = 0\n\tfor x in range(1, len(rights)):\n\t\tans = max(ans, rights[x] - rights[x - 1])\n\tprint(ans)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tsch = 0\n\tmax = 0\n\tfor sym in s:\n\t\tif sym == 'L':\n\t\t\tsch += 1\n\t\telse:\n\t\t\tif sch > max:\n\t\t\t\tmax = sch\n\t\t\tsch = 0\n\tif sch > max:\n\t\tmax = sch\n\tprint(max + 1)\n", "test_cases = int(input())\nstrings = []\nfor i in range(test_cases):\n\ts = input()\n\tstrings.append(s)\nfor string in strings:\n\tif 'R' not in string.upper():\n\t\td = len(string) + 1\n\t\tprint(d)\n\telif 'L' not in string.upper():\n\t\td = 1\n\t\tprint(d)\n\telse:\n\t\tstr_list = string.split('R')\n\t\tstr_list.sort(reverse=True)\n\t\td = len(str_list[0]) + 1\n\t\tprint(d)\n", "t = int(input())\nfor p in range(t):\n\ts = input()\n\tmaxi = 0\n\tx = 0\n\tfor item in s:\n\t\tif item == 'L':\n\t\t\tx += 1\n\t\t\tif x > maxi:\n\t\t\t\tmaxi = x\n\t\telse:\n\t\t\tx = 0\n\tprint(maxi + 1)\n", "import sys\nimport heapq\nfrom math import ceil, floor, gcd, fabs, factorial, fmod\nfrom collections import defaultdict as dd, deque, Counter as c\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisect_right as br, bisect\nmod = pow(10, 9) + 7\nmod2 = 998244353\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef out(var):\n\tsys.stdout.write(var)\n\ndef l():\n\treturn list(map(int, data().split()))\n\ndef sl():\n\treturn list(map(str, data().split()))\n\ndef sp():\n\treturn map(int, data().split())\n\ndef ssp():\n\treturn map(str, data().split())\n\ndef l1d(n, val=0):\n\treturn [val for i in range(n)]\n\ndef l2d(n, m, val=0):\n\treturn [[val for i in range(n)] for j in range(m)]\nfor _ in range(int(data())):\n\ts = data()\n\tanswer = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tanswer.append(i + 1)\n\tanswer.append(len(s) + 1)\n\tres = 1\n\tfor i in range(len(answer) - 1):\n\t\tres = max(res, answer[i + 1] - answer[i])\n\tout(str(res) + '\\n')\n", "for ii in range(int(input())):\n\ta = input()\n\tl = []\n\tn = len(a)\n\tans = n + 1\n\tfor i in range(0, n):\n\t\tif a[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(n + 1)\n\tif len(l) == 1:\n\t\tprint(ans)\n\telse:\n\t\ttemp = l[0]\n\t\tpos = l[0]\n\t\tfor i in range(1, len(l)):\n\t\t\tif l[i] - pos <= temp:\n\t\t\t\tpass\n\t\t\telse:\n\t\t\t\ttemp = l[i] - pos\n\t\t\tpos = l[i]\n\t\tprint(temp)\n", "from sys import stdin\ninput = stdin.readline\nq = int(input())\nfor rwewer in range(q):\n\ts = input()\n\tn = len(s)\n\tnaj_seg = 1\n\todp = 1\n\tcount = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tnaj_seg = max(naj_seg, count + 1)\n\t\t\tcount = 0\n\tnaj_seg = max(naj_seg, count + 1)\n\tprint(naj_seg)\n", "t = int(input())\nfor _ in range(t):\n\ts = str(input())\n\ts = 'R' + s\n\ts = list(s)\n\ts.reverse()\n\ttemp = -1\n\tds = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tds.append(i - temp)\n\t\t\ttemp = i\n\tprint(max(ds))\n", "inf = float('inf')\nfor _ in range(int(input())):\n\ta = -inf\n\tlast = 0\n\tfor (i, x) in enumerate(input(), 1):\n\t\tif x == 'R':\n\t\t\ta = max(a, i - last)\n\t\t\tlast = i\n\tprint(max(a, i + 1 - last))\n", "test_cases = int(input())\nfor i in range(test_cases):\n\tboard = list(map(len, input().split('R')))\n\tprint(max(board) + 1)\n", "for i in range(int(input())):\n\tavl = input()\n\tli = [0]\n\tn = len(avl)\n\tfor j in range(n):\n\t\tif avl[j] == 'R':\n\t\t\tli.append(j + 1)\n\tli.append(n + 1)\n\tnn = len(li)\n\tans = 0\n\tfor j in range(nn - 1):\n\t\tans = max(li[j + 1] - li[j], ans)\n\tprint(ans)\n", "T = int(input())\nfor t in range(T):\n\ts = input()\n\ts += 'R'\n\tc = 1\n\tans = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tans = max(ans, c)\n\t\t\tc = 1\n\t\telse:\n\t\t\tc += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tl = 0\n\tr = 1\n\tB = list()\n\tB.append(0)\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tr += 1\n\t\t\tB.append(i + 1)\n\tB.append(len(s) + 1)\n\tc = 0\n\tfor i in range(0, len(B) - 1):\n\t\tc = max(c, B[i + 1] - B[i])\n\tprint(c)\n", "t = int(input())\nwhile t > 0:\n\t(string, ans, id) = (input(), 1, 0)\n\tstring = 'R' + string + 'R'\n\twhile id < len(string):\n\t\tif string[id] == 'L':\n\t\t\tcount = 1\n\t\t\twhile string[id] != 'R':\n\t\t\t\tcount += 1\n\t\t\t\tid += 1\n\t\t\tans = max(ans, count)\n\t\tid += 1\n\tprint(ans)\n\tt -= 1\n", "for _ in range(int(input())):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tm = 1\n\ti = 0\n\tfor j in range(1, len(s)):\n\t\tif s[j] == 'R':\n\t\t\tm = max(m, j - i)\n\t\t\ti = j\n\tprint(m)\n", "t = int(input())\nfor _ in range(t):\n\ts = input().split('R')\n\ts = list(map(len, s))\n\tprint(max(s) + 1)\n", "t = int(input())\nfor i in range(t):\n\tn = input()\n\tsp = []\n\tx = len(n)\n\tfor i in range(x):\n\t\tif n[i] == 'R':\n\t\t\tsp.append(i)\n\tif len(sp) == 0:\n\t\tprint(x + 1)\n\t\tcontinue\n\td = sp[0] + 1\n\tx = len(sp)\n\tfor i in range(x - 1):\n\t\td = max(d, sp[i + 1] - sp[i])\n\td = max(d, len(n) - sp[-1])\n\tprint(d)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = [0] + [i + 1 for i in range(len(s)) if s[i] == 'R'] + [len(s) + 1]\n\tanswer = 0\n\tfor i in range(1, len(a)):\n\t\tanswer = max(answer, a[i] - a[i - 1])\n\tprint(answer)\n", "t = int(input())\nfor _ in range(t):\n\tstr_ = input()\n\tr_arr = []\n\tfor (idx, i) in enumerate(str_):\n\t\tif i == 'R':\n\t\t\tr_arr.append(idx + 1)\n\tr_arr.append(len(str_) + 1)\n\tr_arr.insert(0, 0)\n\tmax = 0\n\tfor (idx, i) in enumerate(r_arr[1:]):\n\t\tif max < i - r_arr[idx]:\n\t\t\tmax = i - r_arr[idx]\n\tprint(max)\n", "t = int(input())\nfor _ in range(t):\n\t(l, temp) = (0, 0)\n\tfor c in input():\n\t\tif c == 'R':\n\t\t\tl = max(l, temp)\n\t\t\ttemp = 0\n\t\telse:\n\t\t\ttemp += 1\n\tl = max(l, temp)\n\tprint(l + 1)\n", "try:\n\n\tdef fun(n, l):\n\t\tL = list(set(l))\n\t\tif len(L) == 1:\n\t\t\tif L[0] == 'L':\n\t\t\t\treturn n + 1\n\t\t\telse:\n\t\t\t\treturn 1\n\t\tl.append(0)\n\t\tc = 1\n\t\tL = []\n\t\tfor i in l:\n\t\t\tif i == 'L':\n\t\t\t\tc += 1\n\t\t\telse:\n\t\t\t\tL.append(c)\n\t\t\t\tc = 1\n\t\treturn max(L)\n\tt = int(input())\n\tfor _ in range(t):\n\t\tl = input()\n\t\tl = list(l)\n\t\tn = len(l)\n\t\tans = fun(n, l)\n\t\tprint(ans)\nexcept:\n\tpass\n", "import sys, math\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn s[:len(s) - 1]\n\ndef invr():\n\treturn map(int, input().split())\nt = 1\nt = inp()\nfor tt in range(t):\n\ta = insr()\n\ta = 'R' + a + 'R'\n\tw = 0\n\tq = 1\n\tfor i in range(1, len(a)):\n\t\tif a[i] == 'R':\n\t\t\tif i - w >= q:\n\t\t\t\tq = i - w\n\t\t\tw = i\n\tprint(q)\n", "t = int(input())\nfor _ in range(t):\n\tmove = list(input())\n\tcnt = 0\n\tjump = 0\n\tfor i in range(len(move)):\n\t\tif move[i] == 'R':\n\t\t\tjump = max(cnt, jump)\n\t\t\tcnt = 0\n\t\telse:\n\t\t\tcnt += 1\n\tprint(max(cnt, jump) + 1)\n", "from sys import stdin, gettrace\nif not gettrace():\n\n\tdef input():\n\t\treturn next(stdin)[:-1]\n\ndef main():\n\n\tdef solve():\n\t\tss = input()\n\t\tres = 1\n\t\tjump = 1\n\t\tfor s in ss:\n\t\t\tif s == 'L':\n\t\t\t\tjump += 1\n\t\t\telse:\n\t\t\t\tjump = 1\n\t\t\tres = max(jump, res)\n\t\tprint(res)\n\tq = int(input())\n\tfor _ in range(q):\n\t\tsolve()\nmain()\n", "for _ in range(int(input())):\n\ts = input()\n\tl = -1\n\td = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td.append(i - l)\n\t\t\tl = i\n\td.append(len(s) - l)\n\tprint(max(d))\n", "def c(string):\n\td = 0\n\tlast_r = -1\n\tfor (i, s) in enumerate(string):\n\t\tif s == 'R':\n\t\t\td = max(d, i - last_r)\n\t\t\tlast_r = i\n\tprint(max(d, i - last_r + 1))\ntests = int(input())\nwhile tests:\n\tjumps = input()\n\tc(jumps)\n\ttests -= 1\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 0\n\tcur = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcur += 1\n\t\telse:\n\t\t\tans = max(ans, cur)\n\t\t\tcur = 0\n\tans = max(ans, cur)\n\tprint(ans + 1)\n", "t = int(input())\nfor w in range(t):\n\tl = input().split('R')\n\tprint(len(max(l)) + 1)\n", "x = 1\nx += 2\nx = 1\ny = 0\ny += 1\ny = 1\nfor _____ in range(1):\n\tfor tin in range(int(input())):\n\t\ts = str(input())\n\t\tif 'R' not in s:\n\t\t\tprint(len(s) + 1)\n\t\telif 'L' not in s:\n\t\t\tprint('1')\n\t\telse:\n\t\t\ta = []\n\t\t\tfor _ in range(len(s)):\n\t\t\t\tif s[_] == 'R':\n\t\t\t\t\ta.append(_)\n\t\t\tb = []\n\t\t\tfor _ in range(len(a) - 1):\n\t\t\t\tb.append(a[_ + 1] - a[_])\n\t\t\tif len(b) > 0:\n\t\t\t\tprint(max(max(b), max(a[0], len(s) - a[len(a) - 1] - 1) + 1))\n\t\t\telse:\n\t\t\t\tprint(max(a[0], len(s) - a[len(a) - 1] - 1) + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tans = 0\n\tseq = False\n\tx = 0\n\tj = 0\n\twhile j < len(s):\n\t\tif s[j] == 'L':\n\t\t\tif seq == True:\n\t\t\t\tx += 1\n\t\t\telse:\n\t\t\t\tseq = True\n\t\t\t\tx = 1\n\t\telif seq == True:\n\t\t\tif ans < x:\n\t\t\t\tans = x\n\t\t\tseq = False\n\t\t\tx = 0\n\t\tj += 1\n\tprint(ans + 1)\n", "from math import ceil\nfrom collections import deque\nfor _ in range(int(input())):\n\ts = input()\n\tc = 0\n\tmx = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\t\tmx = max(mx, c)\n\t\telse:\n\t\t\tc = 0\n\tprint(mx + 1)\n", "for _ in range(0, int(input())):\n\ts = input()\n\tans = 0\n\tcnt = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tif cnt > ans:\n\t\t\t\tans = cnt\n\t\t\tcnt = 0\n\tif cnt > ans:\n\t\tans = cnt\n\tprint(ans + 1)\n", "for i in range(int(input())):\n\tx = input().split('R')\n\tlong = list(map(len, x))\n\tprint(max(long) + 1)\n", "for item in [0] * int(input()):\n\ts = input()\n\tcount = 0\n\tlength = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\t\tlength = max(length, count)\n\t\telse:\n\t\t\tcount = 0\n\tprint(length + 1)\n", "t = int(input())\n\ndef solve(s):\n\t(mx, cur) = (-1, 0)\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tcur -= 1\n\t\telse:\n\t\t\tmx = max(mx, -cur)\n\t\t\tcur = 0\n\treturn max(mx, -cur) + 1\nfor _ in range(t):\n\ts = input()\n\tprint(solve(s))\n", "for _ in range(int(input())):\n\ts = list(input())\n\tpos = [0]\n\tpos.extend([x + 1 for x in range(len(s)) if s[x] == 'R'])\n\tpos.append(len(s) + 1)\n\tans = 0\n\tfor x in range(len(pos) - 1):\n\t\tans = max(ans, pos[x + 1] - pos[x])\n\tprint(ans)\n", "for _ in range(int(input())):\n\tl = str(input())\n\tb = list()\n\ttry:\n\t\tk = l.index('R')\n\t\tfor i in range(l.index('R') + 1, len(l)):\n\t\t\tif l[i] == 'R':\n\t\t\t\tb.append(i - k)\n\t\t\t\tk = i\n\t\tb.append(l.index('R') + 1)\n\t\tfor j in range(len(l)):\n\t\t\tif l[len(l) - 1 - j] == 'R':\n\t\t\t\tb.append(j + 1)\n\t\t\t\tbreak\n\t\tprint(max(b))\n\texcept:\n\t\tprint(len(l) + 1)\n", "t = int(input())\nfor i in range(t):\n\tl = list(input())\n\tl.insert(0, 'R')\n\tl.append('R')\n\tind = []\n\tfor j in range(len(l)):\n\t\tif l[j] == 'R':\n\t\t\tind.append(j)\n\tMAX = 0\n\tfor j in range(len(ind) - 1):\n\t\tif ind[j + 1] - ind[j] > MAX:\n\t\t\tMAX = ind[j + 1] - ind[j]\n\tprint(MAX)\n", "def ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(mi())\nfor _ in range(ii()):\n\ta = input()\n\tb = []\n\tmaxx = 0\n\tc = 0\n\tfor i in range(len(a)):\n\t\tif a[i] == 'L':\n\t\t\tc += 1\n\t\t\tif maxx < c:\n\t\t\t\tmaxx = c\n\t\telse:\n\t\t\tc = 0\n\tprint(maxx + 1)\n", "for _ in range(int(input())):\n\ts = input() + 'R'\n\tc = 1\n\tmx = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tmx = max(mx, c)\n\t\t\tc = 1\n\tprint(mx)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tmx = 1\n\tcurr = 1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tcurr = 1\n\t\telse:\n\t\t\tcurr += 1\n\t\tmx = max(mx, curr)\n\tprint(mx)\n", "import sys\ninput = sys.stdin.readline\nfrom collections import Counter\nt = int(input())\nfor tests in range(t):\n\tS = input().strip()\n\tNOW = 0\n\tANS = 0\n\tfor s in S:\n\t\tif s == 'L':\n\t\t\tNOW += 1\n\t\telse:\n\t\t\tANS = max(ANS, NOW)\n\t\t\tNOW = 0\n\tANS = max(ANS, NOW)\n\tprint(ANS + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tif s.count('R') == 0:\n\t\tprint(len(s) + 1)\n\telif s.count('L') == 0:\n\t\tprint(1)\n\telse:\n\t\tc = []\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tc.append(i + 1)\n\t\td = []\n\t\tu = len(s) + 1 - max(c)\n\t\tif len(c) >= 2:\n\t\t\tfor i in range(len(c) - 1):\n\t\t\t\td.append(c[i + 1] - c[i])\n\t\telse:\n\t\t\td.append(0)\n\t\tif u > max(d) and u > c[0]:\n\t\t\tprint(u)\n\t\telif max(d) >= u and max(d) >= c[0]:\n\t\t\tprint(max(d))\n\t\telif c[0] >= max(d) and c[0] >= u:\n\t\t\tprint(c[0])\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tl = [0]\n\tfor k in range(len(s)):\n\t\tif s[k] == 'R':\n\t\t\tl.append(k + 1)\n\tl.append(len(s) + 1)\n\tans = 0\n\tfor j in range(len(l) - 1):\n\t\tans = max(ans, l[j + 1] - l[j])\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ta = []\n\tarr = s.split('R')\n\tfor i in range(0, len(arr)):\n\t\ta.append(len(arr[i]))\n\tprint(max(a) + 1)\n", "n = int(input())\nfor i in range(n):\n\tL = [0]\n\tans = 0\n\tl = list(map(str, input()))\n\tF = ['R']\n\tfor p in l:\n\t\tF.append(p)\n\tF.append('R')\n\tfor j in range(len(F)):\n\t\tif F[j] == 'R':\n\t\t\tL.append(j)\n\tfor k in range(1, len(L)):\n\t\tans = max(ans, L[k] - L[k - 1])\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tjumps = input()\n\tlast_r = -1\n\tmax_diff = float('-inf')\n\tfor (idx, ch) in enumerate(jumps):\n\t\tif ch == 'R':\n\t\t\tmax_diff = max(max_diff, idx - last_r)\n\t\t\tlast_r = idx\n\tmax_diff = max(max_diff, len(jumps) - last_r)\n\tprint(max_diff)\n", "for _ in range(int(input())):\n\ta = input()\n\td = 1\n\tdmax = 1\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\td += 1\n\t\telse:\n\t\t\tif dmax < d:\n\t\t\t\tdmax = d\n\t\t\td = 1\n\tif dmax < d:\n\t\tdmax = d\n\tprint(dmax)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ts = input()\n\ta = s.split('R')\n\tprint(len(max(a)) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\t(gl, ll) = (1, 1)\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tll += 1\n\t\telse:\n\t\t\tgl = max(ll, gl)\n\t\t\tll = 1\n\t\tgl = max(ll, gl)\n\tprint(gl)\n", "for _ in [0] * int(input()):\n\ts = input() + 'R'\n\tr = i = 0\n\twhile i < len(s):\n\t\tj = s.find('R', i) + 1\n\t\tr = max(r, j - i)\n\t\ti = j\n\tprint(r)\n", "for _ in range(int(input())):\n\tbest = 0\n\tcurr = 0\n\tfor c in input():\n\t\tif c == 'R':\n\t\t\tcurr = 0\n\t\telse:\n\t\t\tcurr += 1\n\t\tif curr > best:\n\t\t\tbest = curr\n\tprint(best + 1)\n", "T = int(input())\nfor t in range(T):\n\ts = 'R' + input() + 'R'\n\tl = len(s)\n\tres = 0\n\tprev = 0\n\tfor i in range(1, l):\n\t\tc = s[i]\n\t\tif c == 'R':\n\t\t\tif i - prev > res:\n\t\t\t\tres = i - prev\n\t\t\tprev = i\n\tprint(res)\n", "for _ in range(int(input())):\n\ts = input()\n\tind = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tind.append(i + 1)\n\tind.append(len(s) + 1)\n\tmx = 0\n\tfor i in range(len(ind) - 1):\n\t\tmx = max(mx, ind[i + 1] - ind[i])\n\tprint(mx)\n", "for _ in range(int(input())):\n\tst = str(input())\n\tli = max(map(len, st.split('R')))\n\tprint(li + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tans = -1\n\tlast = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tans = max(ans, j - last)\n\t\t\tlast = j\n\tprint(ans)\n", "t = int(input())\nfor q in range(t):\n\ts = input()\n\tl = 0\n\tm = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tm = max(l, m)\n\t\t\tl = 0\n\tm = max(l, m)\n\tprint(m + 1)\n", "t = int(input())\nfor i in range(t):\n\ta = input()\n\tb = [0]\n\tc = []\n\tfor j in range(len(a)):\n\t\tif a[j] == 'R':\n\t\t\tb.append(j + 1)\n\tb.append(len(a) + 1)\n\tfor k in range(len(b) - 1):\n\t\tc.append(b[k + 1] - b[k])\n\tprint(max(c))\n", "for _ in range(int(input())):\n\ts = input()\n\ts = '#' + s + 'R'\n\tpos = 0\n\tans = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans.append(i - pos)\n\t\t\tpos = i\n\tprint(max(ans))\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n\ndef solution(s):\n\tn = len(s)\n\tr_indices = [i + 1 for i in range(n) if s[i] == 'R']\n\tr_indices.append(n + 1)\n\tr_indices.insert(0, 0)\n\tres = max((r_indices[i + 1] - r_indices[i] for i in range(len(r_indices) - 1)))\n\twrite(res)\n\ndef main():\n\tfor _ in range(r_int()):\n\t\ts = input()\n\t\tsolution(s)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\ndef input():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\n\ndef write(x='', end='\\n'):\n\tsys.stdout.write(str(x) + end)\n\ndef r_array():\n\treturn [int(x) for x in input().split()]\n\ndef r_int():\n\treturn int(input())\n\ndef p_array(arr):\n\tfor x in arr:\n\t\twrite(x, end=' ')\n\twrite()\nmain()\n", "from math import *\nimport heapq\nT = int(input())\nfor _ in range(T):\n\tarr = input()\n\tj = 0\n\tArr = []\n\tArr.append(0)\n\twhile arr.find('R', j) != -1:\n\t\tj = arr.find('R', j) + 1\n\t\tArr.append(j)\n\tArr.append(len(arr) + 1)\n\tMax = 0\n\tfor i in range(1, len(Arr)):\n\t\tMax = max(Max, Arr[i] - Arr[i - 1])\n\tprint(Max)\n", "t = int(input())\nfor _ in range(t):\n\ts = list(input())\n\tcount = 0\n\tmx = 0\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > mx:\n\t\t\t\tmx = count\n\t\t\tcount = 0\n\tif count > mx:\n\t\tmx = count\n\tprint(mx + 1)\n", "numTests = int(input())\nfor _ in range(numTests):\n\tcols = input()\n\tlongest = 0\n\tcount = 0\n\tfor ii in range(len(cols)):\n\t\tif cols[ii] == 'L':\n\t\t\tcount += 1\n\t\t\tif count > longest:\n\t\t\t\tlongest = count\n\t\telse:\n\t\t\tcount = 0\n\tprint(longest + 1)\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef solve(s):\n\tt = 0\n\tcount = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tt += 1\n\t\telif s[j] == 'R':\n\t\t\tcount = max(count, t)\n\t\t\tt = 0\n\tif j == len(s) - 1:\n\t\tcount = max(count, t)\n\tprint(count + 1)\nt = inp()\nfor _ in range(t):\n\tjumps = insr()\n\tsolve(jumps)\n", "for _ in range(int(input())):\n\tX = input()\n\tMax = 0\n\tCount = 0\n\tfor i in X:\n\t\tif i == 'L':\n\t\t\tCount += 1\n\t\t\tMax = max(Max, Count)\n\t\telse:\n\t\t\tCount = 0\n\tprint(Max + 1)\n", "t = int(input())\nfor _ in range(t):\n\tst = input()\n\tmax_d = 0\n\tlast_r = -1\n\tfor (i, s) in enumerate(st):\n\t\tif s == 'R':\n\t\t\tmax_d = max(max_d, i - last_r)\n\t\t\tlast_r = i\n\tmax_d = max(max_d, len(st) - last_r)\n\tprint(max_d)\n", "t = int(input())\nfor i in range(t):\n\tstr_ = [i for i in input()]\n\tstr_.append('R')\n\tmaxa = [0]\n\tfor j in range(len(str_)):\n\t\tif str_[j] == 'R':\n\t\t\tmaxa.append(j + 1)\n\tprecalc = []\n\tfor j in range(1, len(maxa)):\n\t\tprecalc.append(maxa[j] - maxa[j - 1])\n\tprint(max(precalc))\n", "def solve(path):\n\tpath = 'R' + path\n\tindexes_of_R = [i for i in range(len(path)) if path[i] is 'R'] + [len(path)]\n\tapart = [indexes_of_R[j + 1] - indexes_of_R[j] for j in range(len(indexes_of_R) - 1)]\n\treturn max(apart)\nt = int(input())\nfor i in range(t):\n\tpath = input()\n\ty = solve(path)\n\tprint(y)\n", "import sys\ninput = sys.stdin.readline\n\ndef fastio():\n\tfrom io import StringIO\n\tfrom atexit import register\n\tglobal input\n\tsys.stdin = StringIO(sys.stdin.read())\n\tinput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\tsys.stdout = StringIO()\n\tregister(lambda : sys.__stdout__.write(sys.stdout.getvalue()))\nfastio()\nINF = 10 ** 20\nMOD = 998244353\nI = lambda : list(map(int, input().split()))\nfrom math import gcd\nfrom math import ceil\nfrom collections import defaultdict as dd, Counter\nfrom bisect import bisect_left as bl, bisect_right as br\n(t,) = I()\nwhile t:\n\tt -= 1\n\ts = input() + 'R'\n\tprev = -1\n\tn = len(s)\n\tans = -1\n\t(first, last) = (-1, -1)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - prev)\n\t\t\tprev = i\n\tif ans == -1:\n\t\tans = n\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\t(got, c, m) = (False, 1, 0)\n\tfor (i, el) in enumerate(s):\n\t\tif el == 'R' and (not got):\n\t\t\tgot = True\n\t\t\tm = c\n\t\t\tc = 1\n\t\telif el == 'L':\n\t\t\tc += 1\n\t\telif el == 'R' and got:\n\t\t\tm = max(c, m)\n\t\t\tc = 1\n\tprint(max(c, m))\n", "import math\nimport bisect\nfrom itertools import groupby\n\ndef rints():\n\treturn list(map(int, input().split()))\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tans = 1\n\tfor (key, g) in groupby(s):\n\t\tif key == 'L':\n\t\t\tans = max(ans, len(list(g)) + 1)\n\tprint(ans)\n", "for _ in range(int(input())):\n\tl = list(input())\n\tans = []\n\tn = len(l)\n\tans.append(0)\n\tfor i in range(n):\n\t\tif l[i] == 'R':\n\t\t\tans.append(i + 1)\n\tans.append(n + 1)\n\tif len(ans) == 2:\n\t\tprint(n + 1)\n\t\tcontinue\n\tres = 0\n\tfor i in range(len(ans) - 1):\n\t\tres = max(res, ans[i + 1] - ans[i])\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\tstring = list(map(str, input()))\n\tR_count = string.count('R')\n\tL_count = string.count('L')\n\tindex = -3\n\tif R_count == len(string):\n\t\tprint('1')\n\telif L_count == len(string):\n\t\tprint(L_count + 1)\n\telse:\n\t\tarr = []\n\t\tarr.append(0)\n\t\tfor i in range(len(string)):\n\t\t\tif string[i] == 'R':\n\t\t\t\tarr.append(i + 1)\n\t\tarr.append(len(string) + 1)\n\t\tans = -1\n\t\tfor i in range(len(arr) - 1):\n\t\t\tans = max(arr[i + 1] - arr[i], ans)\n\t\tans = max(arr[i + 1] - arr[i], ans)\n\t\tprint(ans)\n", "import sys\nT = int(sys.stdin.readline())\nfor _ in range(T):\n\tlist_cell = list(sys.stdin.readline().strip())\n\tformer = 'L'\n\tcount = 1\n\tresult = 0\n\tfor cell in list_cell:\n\t\tif cell == 'R':\n\t\t\tcount = 1\n\t\telse:\n\t\t\tcount += 1\n\t\tresult = max(result, count)\n\tprint(result)\n", "from sys import stdin, stdout\nimport math\nfrom collections import defaultdict\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tans = 1\n\ttempans = 1\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tans = max(ans, tempans)\n\t\t\ttempans = 1\n\t\telse:\n\t\t\ttempans += 1\n\tprint(ans)\n", "test = int(input())\nfor _ in range(test):\n\ts = input()\n\tarr = [0]\n\tfor (i, x) in enumerate(s):\n\t\tif x == 'R':\n\t\t\tarr.append(i + 1)\n\tarr.append(len(s) + 1)\n\tans = 0\n\tfor i in range(0, len(arr) - 1):\n\t\tans = max(ans, arr[i + 1] - arr[i])\n\tprint(ans)\n", "for _ in range(int(input())):\n\tst = input()\n\td = tmp = 0\n\tfor i in range(len(st)):\n\t\tif st[i] == 'L':\n\t\t\ttmp += 1\n\t\telif st[i] == 'R':\n\t\t\td = max(d, tmp)\n\t\t\ttmp = 0\n\td = max(d, tmp)\n\tprint(d + 1)\n", "m = int(input())\nfor j in range(m):\n\ts = str(input())\n\td = 1\n\tnewd = 1\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tnewd = newd + 1\n\t\telse:\n\t\t\td = max(d, newd)\n\t\t\tnewd = 1\n\tprint(max(d, newd))\n", "from sys import stdin, stdout\nfor _ in range(int(stdin.readline())):\n\tstring = stdin.readline().strip()\n\tlis = string.split('R')\n\tmaxi = 0\n\tfor i in lis:\n\t\tif maxi < len(i):\n\t\t\tmaxi = len(i)\n\tmaxi += 1\n\tstdout.write(str(maxi))\n\tstdout.write('\\n')\n", "res = []\nfor _ in range(int(input())):\n\tA = input()\n\tj = 1\n\tk = 0\n\tA = f'{A}R'\n\tjump = []\n\tfor (i, s) in enumerate(A, 1):\n\t\tif s == 'R':\n\t\t\tjump.append(i - k)\n\t\t\tk = i\n\tres.append(max(jump))\nfor r in res:\n\tprint(r)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ts = input()\n\ts = 's' + s + 'f'\n\td = []\n\tlastR = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\td.append(i - lastR)\n\t\t\tlastR = i\n\t\tif s[i] == 'f':\n\t\t\td.append(i - lastR)\n\tprint(max(d))\n", "T = int(input())\nfor _ in range(T):\n\tsl = input()\n\tl = list(sl)\n\ts = set(l)\n\tif len(s) == 1:\n\t\tl1 = list(s)\n\t\tif l1[0] == 'L':\n\t\t\tprint(len(l) + 1)\n\t\telse:\n\t\t\tprint('1')\n\telse:\n\t\tc = 1\n\t\ti = 0\n\t\tn = len(l)\n\t\twhile i < n:\n\t\t\tif l[i] == 'L':\n\t\t\t\tcp = 0\n\t\t\t\tfor j in range(i, n):\n\t\t\t\t\tif l[j] == 'L':\n\t\t\t\t\t\tcp = cp + 1\n\t\t\t\t\telse:\n\t\t\t\t\t\tbreak\n\t\t\t\ti = i + cp\n\t\t\t\tif cp > c:\n\t\t\t\t\tc = cp\n\t\t\telse:\n\t\t\t\ti = i + 1\n\t\tprint(c + 1)\n", "num = int(input())\nfor _ in range(num):\n\ts = input() + 'R'\n\td = 0\n\tcnt = 1\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\td = max([d, cnt])\n\t\t\tcnt = 1\n\tif d == 0:\n\t\tc = len(s) - 1\n\tprint(d)\n", "output = ''\nfor _ in range(int(input())):\n\ti = input().split('R')\n\tl = [len(n) for n in i]\n\toutput += str(max(l) + 1) + '\\n'\nprint(output)\n", "for _ in range(int(input())):\n\ts = input()\n\tl = [0, len(s) + 1]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.sort()\n\tx = 0\n\tfor i in range(len(l) - 1):\n\t\tx = max(x, l[i + 1] - l[i])\n\tprint(x)\n", "for tc in range(int(input())):\n\ts = 'R' + input() + 'R'\n\tc = s.count('R')\n\tm = -100\n\tar = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tar.append(i)\n\tfor i in range(len(ar) - 1):\n\t\tm = max(m, abs(ar[i] - ar[i + 1]))\n\tprint(m)\n", "t = int(input())\nfor rep in range(t):\n\ts = input()\n\tmaxi = 0\n\tcount = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > maxi:\n\t\t\t\tmaxi = count\n\t\t\tcount = 0\n\tif count > maxi:\n\t\tmaxi = count\n\tprint(maxi + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\t(count, k) = (set(), 0)\n\tfor elem in s:\n\t\tif elem == 'L':\n\t\t\tk += 1\n\t\telse:\n\t\t\tcount.add(k)\n\t\t\tk = 0\n\tcount.add(k)\n\tprint(str(max(count) + 1))\n", "for i in range(int(input())):\n\ts = input()\n\tcur = -1\n\tr = -1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tif j - cur > r:\n\t\t\t\tr = j - cur\n\t\t\tcur = j\n\tif len(s) - cur > r:\n\t\tr = len(s) - cur\n\tprint(r)\n", "for _ in [0] * int(input()):\n\tstri = input()\n\tznach = 1\n\tli = []\n\tfor i in stri:\n\t\tif i == 'L':\n\t\t\tznach += 1\n\t\telse:\n\t\t\tif znach:\n\t\t\t\tli.append(znach)\n\t\t\tznach = 1\n\tif znach:\n\t\tli.append(znach)\n\t\tprint(max(li))\n", "testCase = int(input())\nfor i1 in range(testCase):\n\tsequence = input()\n\tindexR = sequence.find('R') + 1\n\tif indexR == 0:\n\t\tindexR = len(sequence) + 1\n\tdistance = [0]\n\ti2 = 0\n\twhile i2 < len(sequence):\n\t\tif sequence[i2] == 'L':\n\t\t\tinitial = i2\n\t\t\twhile i2 < len(sequence) and sequence[i2] == 'L':\n\t\t\t\ti2 += 1\n\t\t\tfinal = i2\n\t\t\tdistance.append(final - initial + 1)\n\t\ti2 += 1\n\tresult = max(indexR, max(distance))\n\tprint(result)\n", "for _ in range(int(input())):\n\tarr = input()\n\tmaks = 0\n\ttemp = 1 if arr[0] == 'L' else 0\n\tfor i in range(1, len(arr)):\n\t\tif arr[i] == 'L' and arr[i - 1] == arr[i]:\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tmaks = max(maks, temp)\n\t\t\ttemp = 1 if arr[i] == 'L' else 0\n\tmaks = max(maks, temp)\n\tprint(maks + 1)\n", "t = int(input())\nans = []\nfor _ in range(t):\n\ts = 'R' + input() + 'R'\n\tlast_r = 0\n\tmax_len = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif max_len < i - last_r:\n\t\t\t\tmax_len = i - last_r\n\t\t\tlast_r = i\n\tans.append(max_len)\nprint('\\n'.join((str(i) for i in ans)))\n", "def minD(s):\n\tp = -1\n\tm = 0\n\ts = s + 'R'\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - p > m:\n\t\t\t\tm = i - p\n\t\t\tp = i\n\treturn m\nt = int(input())\n[print(minD(input())) for _ in range(t)]\n", "from bisect import bisect_left, bisect_right\nfrom typing import List\nimport collections\nimport bisect\nimport itertools\nimport functools\nfrom fractions import gcd\nimport heapq\nfrom math import ceil, sqrt, floor\nimport sys\nsys.setrecursionlimit(50000)\nimport collections\nfrom collections import defaultdict, deque\nimport collections\nT = int(input())\nfor _ in range(T):\n\ts = 'R' + input() + 'R'\n\tRs = [i for i in range(len(s)) if s[i] == 'R']\n\tmaxv = 0\n\tfor i in range(len(Rs) - 1):\n\t\tmaxv = max(maxv, Rs[i + 1] - Rs[i])\n\tprint(maxv)\n", "T = int(input())\nfor i in range(T):\n\tS = str(input())\n\tL = -1\n\tstat = 0\n\tminI = 1000000\n\tLen = len(S)\n\tDist = []\n\tfor i in range(Len):\n\t\tif S[i] == 'R':\n\t\t\tDist.append(i - L)\n\t\t\tL = i\n\t\t\tstat = 1\n\tDist.append(Len - L)\n\tif stat == 0:\n\t\tprint(Len + 1)\n\telse:\n\t\tprint(max(Dist))\n", "for _ in range(int(input())):\n\tans = 0\n\tp = 0\n\ts = input()\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tp += 1\n\t\telse:\n\t\t\tp = 0\n\t\tans = max(ans, p)\n\tprint(ans + 1)\n", "for _ in range(int(input())):\n\ts = input() + ' '\n\tcnt = 1\n\tnow = 1\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tnow += 1\n\t\telse:\n\t\t\tif now > cnt:\n\t\t\t\tcnt = now\n\t\t\tnow = 1\n\tprint(cnt)\n", "for i in range(int(input())):\n\ts = input()\n\tm = s.find('R')\n\tif m == -1:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tl = -1\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tm = max(m, i - l)\n\t\t\t\tl = i\n\t\tprint(max(m, len(s) - l))\n", "def one():\n\treturn int(input())\n\ndef more():\n\treturn list(map(int, input().split()))\nfor _ in range(one()):\n\ts = input() + 'R'\n\tcur = 0\n\tmx = -1\n\tfor (ind, i) in enumerate(s):\n\t\tif i == 'R':\n\t\t\td = ind + 1 - cur\n\t\t\tmx = max(mx, d)\n\t\t\tcur = ind + 1\n\tprint(mx)\n", "T = int(input())\nfor t in range(T):\n\tst = input()\n\tn = len(st)\n\tpos = [0]\n\tfor i in range(n):\n\t\tif st[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(n + 1)\n\tans = -1\n\tfor i in range(1, len(pos)):\n\t\tans = max(ans, pos[i] - pos[i - 1])\n\tprint(ans)\n", "casos = int(input())\nfor i in range(casos):\n\tpassos = input()\n\tcont_R = 1\n\tcont_R_list = [len(passos) + 1]\n\tfor s in passos + 'R':\n\t\tif s == 'R':\n\t\t\tcont_R_list.append(cont_R)\n\t\t\tcont_R = 1\n\t\tif s == 'L':\n\t\t\tcont_R += 1\n\tif len(cont_R_list) > 1:\n\t\tprint(max(cont_R_list[1:]))\n\telse:\n\t\tprint(cont_R_list[0])\n", "T = int(input())\nt = 0\nwhile t < T:\n\ts = input()\n\tconta = 0\n\trisultato = 0\n\tn = 0\n\tN = len(s)\n\twhile n < N:\n\t\tl = s[n]\n\t\tif l == 'L':\n\t\t\tconta = conta + 1\n\t\telse:\n\t\t\tconta = 0\n\t\tif conta > risultato:\n\t\t\trisultato = conta\n\t\tn = n + 1\n\tprint(risultato + 1)\n\tt = t + 1\n", "from collections import Counter\nT = int(input())\nfor _ in range(T):\n\tj = 'R' + input() + 'R'\n\tRR = []\n\tfor i in range(len(j)):\n\t\tif j[i] == 'R':\n\t\t\tRR.append(i)\n\tanswer = 0\n\tfor i in range(len(RR)):\n\t\tanswer = max(answer, RR[i] - RR[i - 1])\n\tprint(answer)\n", "import math\nimport itertools\ngh = lambda : map(int, input().split())\nmod = 998244353\nmod = int(mod)\n\ndef main():\n\tt = int(input())\n\twhile t:\n\t\ts = '0' + input() + 'n'\n\t\tmx = 0\n\t\ti = 0\n\t\tn = len(s) - 1\n\t\twhile i < n:\n\t\t\tj = 1\n\t\t\twhile i + j < n and s[i + j] != 'R':\n\t\t\t\tj += 1\n\t\t\tmx = max(mx, j)\n\t\t\ti += j\n\t\tprint(mx)\n\t\tt -= 1\nmain()\n", "for _ in range(int(input())):\n\ts = list(input())\n\tc = 0\n\tm = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tm = max(m, c)\n\t\t\tc = 0\n\tif c != 0:\n\t\tm = max(m, c)\n\t\tc = 0\n\tprint(m + 1)\n", "def longestConsecutiveL(s):\n\tlongest = 0\n\tlocal = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tlocal += 1\n\t\t\tlongest = max(local, longest)\n\t\telse:\n\t\t\tlocal = 0\n\treturn longest\nfor _ in range(int(input())):\n\tcell = input()\n\tans = longestConsecutiveL(cell)\n\tprint(ans + 1)\n", "import sys\nimport math\nimport bisect\nfrom sys import stdin, stdout\nfrom math import gcd, floor, sqrt, log2, ceil\nfrom collections import defaultdict\nfrom bisect import bisect_left as bl, bisect_right as br\nfrom collections import Counter\nfrom collections import deque\nip = lambda : int(stdin.readline())\ninp = lambda : map(int, stdin.readline().split())\nips = lambda : stdin.readline().rstrip()\nt = ip()\nfor _ in range(t):\n\ts = ips()\n\tans = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans.append(i + 1)\n\tans.append(len(s) + 1)\n\tch = -1\n\tfor i in range(1, len(ans)):\n\t\tch = max(ch, ans[i] - ans[i - 1])\n\tprint(ch)\n", "t = int(input())\nfor w in range(t):\n\ts = input()\n\tc = 0\n\tmc = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\t\tif c > mc:\n\t\t\t\tmc = c\n\t\telse:\n\t\t\tc = 0\n\tprint(mc + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tprev = -1\n\tans = 0\n\tfl = False\n\tf1 = False\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tf1 = True\n\t\tif s[i] == 'R':\n\t\t\tfl = True\n\t\t\tif prev == -1:\n\t\t\t\tans = max(ans, i + 1)\n\t\t\telse:\n\t\t\t\tans = max(ans, i - prev)\n\t\t\tprev = i\n\tif prev != len(s) - 1:\n\t\tans = max(ans, len(s) - prev)\n\tif not f1:\n\t\tprint(1)\n\telif not fl:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tprint(ans)\n", "def ans(s):\n\taaa = 0\n\tt = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tt += 1\n\t\telse:\n\t\t\taaa = max(aaa, t)\n\t\t\tt = 0\n\taaa = max(aaa, t)\n\treturn aaa + 1\nfor i in range(int(input())):\n\ts = input()\n\tprint(ans(s))\n", "num_t = int(input())\nfor _ in range(num_t):\n\ts = input()\n\tmax_l = 0\n\tl = 0\n\tfor e in s:\n\t\tif e == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tmax_l = max(l, max_l)\n\t\t\tl = 0\n\tmax_l = max(l, max_l)\n\tprint(max_l + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tind = 0\n\tr = 0\n\tmaxx = -1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tr = j + 1 - ind\n\t\t\tmaxx = max(r, maxx)\n\t\t\tind = j + 1\n\tprint(max(maxx, len(s) + 1 - ind))\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tif 'R' not in s:\n\t\tprint(len(s) + 1)\n\telif s.count('R') == 1:\n\t\tf = s.find('R')\n\t\tprint(max(f + 1, len(s) - f))\n\telif s.count('R') == len(s):\n\t\tprint(1)\n\telse:\n\t\tj = 0\n\t\tmaxx = s.find('R', j) + 1\n\t\twhile j < len(s):\n\t\t\tk = s.find('R', j + 1)\n\t\t\tif k == -1:\n\t\t\t\tmaxx = max(maxx, len(s) - j)\n\t\t\t\tj = len(s)\n\t\t\telse:\n\t\t\t\tif abs(k - j) > maxx:\n\t\t\t\t\tmaxx = abs(k - j)\n\t\t\t\tj = k\n\t\tprint(maxx)\n", "t = int(input())\nwhile t != 0:\n\ts = list(input())\n\tRs = []\n\tm = 0\n\tif 'R' in s:\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tRs.append(i)\n\t\tfor i in range(1, len(Rs)):\n\t\t\tm = max(m, Rs[i] - Rs[i - 1])\n\t\tm = max(Rs[0] + 1, m, len(s) - Rs[-1])\n\telse:\n\t\tm = len(s) + 1\n\tprint(m)\n\tt = t - 1\n", "t = int(input())\nfor _ in range(t):\n\t(s, t, res) = (input() + '#', 0, 1)\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tt += 1\n\t\telse:\n\t\t\tres = max(res, t + 1)\n\t\t\tt = 0\n\tprint(res)\n", "for _ in range(int(input())):\n\ts = input().split('R')\n\tm = -1\n\tfor i in s:\n\t\tif len(i) > m:\n\t\t\tm = len(i)\n\tprint(m + 1)\n", "n = int(input())\nfor i in range(n):\n\ts = list(input().split('R'))\n\tmax = 0\n\tfor i in s:\n\t\tx = len(i)\n\t\tif x > max:\n\t\t\tmax = x\n\tprint(max + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tind = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tind.append(i)\n\tif len(ind) <= 1:\n\t\tprint(len(ind) + 1)\n\telse:\n\t\tt = 0\n\t\tAns = []\n\t\tfor i in range(1, len(ind)):\n\t\t\tif ind[i] - ind[i - 1] == 1:\n\t\t\t\tt += 1\n\t\t\telse:\n\t\t\t\tAns.append(t)\n\t\t\t\tt = 0\n\t\tAns.append(t)\n\t\tprint(max(Ans) + 2)\n", "for i in range(int(input())):\n\n\tdef list_duplicates_of(seq, item):\n\t\tstart_at = -1\n\t\tlocs = []\n\t\twhile True:\n\t\t\ttry:\n\t\t\t\tloc = seq.index(item, start_at + 1)\n\t\t\texcept ValueError:\n\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\tlocs.append(loc)\n\t\t\t\tstart_at = loc\n\t\treturn locs\n\tsource = input()\n\tt = list_duplicates_of(source, 'R')\n\tt.insert(len(t), len(source))\n\tv = [t[i + 1] - t[i] for i in range(len(t) - 1)]\n\tv.insert(0, min(t) + 1)\n\tprint(max(v))\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tmx = []\n\tprev = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmx += [i - prev]\n\t\t\tprev = i\n\tprint(max(mx))\n", "t = int(input())\nfor i in range(t):\n\ts = list(input())\n\tarr = []\n\tbrr = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tarr.append(i + 1)\n\tarr.insert(0, 0)\n\tarr.insert(len(arr), len(s) + 1)\n\tfor i in range(len(arr) - 1):\n\t\tbrr.append(arr[i + 1] - arr[i])\n\tprint(max(brr))\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 0\n\tprev = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - prev)\n\t\t\tprev = i\n\tans = max(ans, len(s) - prev)\n\tif prev == -1:\n\t\tans = len(s) + 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = str(input())\n\tans = 0\n\ttmp = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\ttmp += 1\n\t\telse:\n\t\t\tans = max(tmp, ans)\n\t\t\ttmp = 0\n\tprint(max(ans, tmp) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tj = 0\n\tdif = 0\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tj = i + 1 - j\n\t\t\tdif = max(dif, j)\n\t\t\tj = i + 1\n\tdif = max(dif, n + 1 - j)\n\tprint(dif)\n", "t = int(input())\nfor tk in range(t):\n\ts = list(map(str, input().split('R')))\n\tmx = 0\n\tfor i in s:\n\t\tmx = max(mx, len(i))\n\tprint(mx + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tb = []\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tb.append(j + 1)\n\tb.append(len(s) + 1)\n\tmx_d = b[0]\n\tfor j in range(len(b) - 1):\n\t\tmx_d = max(mx_d, b[j + 1] - b[j])\n\tprint(mx_d)\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 0\n\tmini = []\n\treset = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L' and reset <= ans:\n\t\t\tans += 1\n\t\t\treset += 1\n\t\telse:\n\t\t\treset = 0\n\t\t\tmini.append(ans)\n\t\t\tans = 0\n\tmini.append(ans)\n\tprint(max(mini) + 1)\n", "for _ in range(int(input())):\n\ts = input().strip()\n\tn = len(s)\n\tif s.count('R') == 0:\n\t\tprint(n + 1)\n\telif s.count('L') == 0:\n\t\tprint(1)\n\telse:\n\t\tprev = s.index('R')\n\t\tb = prev\n\t\tct = prev + 1\n\t\tfor i in range(b + 1, n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tct = max(ct, i - prev)\n\t\t\t\tprev = i\n\t\tct = max(ct, n - prev)\n\t\tprint(ct)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tans = 1\n\tn = len(s)\n\tpr = -1\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tans = max(ans, i - pr + 1)\n\t\telse:\n\t\t\tpr = i\n\tprint(ans)\n", "def main():\n\tt = int(input())\n\tfor i in range(t):\n\t\ts = input()\n\t\tright = 0\n\t\tright_local = 1\n\t\tfor jump in s:\n\t\t\tif jump == 'R':\n\t\t\t\tif right_local > right:\n\t\t\t\t\tright = right_local\n\t\t\t\tright_local = 1\n\t\t\telif jump == 'L':\n\t\t\t\tright_local += 1\n\t\tif s[-1:] == 'L' and right_local > right:\n\t\t\tright = right_local\n\t\tresult = right if right > 0 else len(s)\n\t\tprint(result)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\ts = input().rstrip()\n\tn = len(s)\n\tif 'L' not in s:\n\t\tprint(1)\n\telse:\n\t\tc = m = 1\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] == s[i + 1] and s[i] == 'L':\n\t\t\t\tc += 1\n\t\t\telse:\n\t\t\t\tif c > m:\n\t\t\t\t\tm = c\n\t\t\t\tc = 1\n\t\tif c > m:\n\t\t\tm = c\n\t\tprint(m + 1)\n", "import math, sys\ninput = sys.stdin.readline\nS = lambda : input().rstrip()\nI = lambda : int(S())\nM = lambda : map(int, S().split())\nL = lambda : list(M())\nmod1 = 1000000007\nmod2 = 998244353\nfor _ in range(I()):\n\ts = S()\n\ts = 'R' + s + 'R'\n\tans = 0\n\tprev = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - prev)\n\t\t\tprev = i\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = list(input())\n\ta = []\n\ti = 0\n\ta.append(0)\n\twhile i < len(s):\n\t\tif s[i] == 'R':\n\t\t\ta.append(i + 1)\n\t\ti = i + 1\n\ta.append(i + 1)\n\tb = []\n\ti = 0\n\twhile i < len(a) - 1:\n\t\tb.append(a[i + 1] - a[i])\n\t\ti = i + 1\n\tprint(max(b))\n", "def solve(s):\n\tmaxl = 0\n\tc = 0\n\tfor l in s:\n\t\tif l == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\t\tmaxl = max(maxl, c)\n\treturn maxl + 1\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\ts = input()\n\t\tprint(solve(s))\nmain()\n", "n = int(input())\nfor p in range(n):\n\tx = input()\n\tl = []\n\ts = 1\n\tfor i in range(len(x) - 1):\n\t\tif x[i] == 'L' and x[i + 1] == 'L':\n\t\t\ts += 1\n\t\telse:\n\t\t\tl.append(s)\n\t\t\ts = 1\n\tl.append(s)\n\tif x.find('L') == -1:\n\t\tprint(max(l))\n\telse:\n\t\tprint(max(l) + 1)\n", "n = int(input())\nfor i in range(n):\n\tpath = input()\n\trpos = []\n\tfor k in range(len(path)):\n\t\tif path[k] == 'R':\n\t\t\trpos.append(k + 1)\n\trpos.insert(0, 0)\n\trpos.append(len(path) + 1)\n\tMax = 0\n\tfor i in range(len(rpos) - 1):\n\t\tif rpos[i + 1] - rpos[i] > Max:\n\t\t\tMax = rpos[i + 1] - rpos[i]\n\tprint(Max)\n", "for _ in range(int(input())):\n\ts = input()\n\ti = 0\n\tcount = 0\n\tmax_ = 1\n\twhile i < len(s):\n\t\tif s[i] == 'L':\n\t\t\tt = 'L'\n\t\t\twhile i < len(s) and t == s[i]:\n\t\t\t\tcount += 1\n\t\t\t\ti += 1\n\t\t\tcount += 1\n\t\t\tif count > max_:\n\t\t\t\tmax_ = count\n\t\t\tcount = 0\n\t\telse:\n\t\t\ti += 1\n\tprint(max_)\n", "import sys\nfor _ in range(int(sys.stdin.readline().rstrip())):\n\ts = sys.stdin.readline().rstrip() + 'E'\n\tchk = [0] * len(s)\n\tcnt = 1\n\tfor i in range(len(s)):\n\t\tchk[i] = cnt\n\t\tcnt += 1\n\t\tif s[i] == 'R':\n\t\t\tcnt = 1\n\tprint(max(chk))\n", "from sys import stdin, stdout\nfor i1 in range(int(stdin.readline())):\n\ts = stdin.readline()\n\ts = 'R' + s\n\tn = len(s)\n\ta = []\n\ti = n - 1\n\tc = 0\n\twhile i >= 0:\n\t\tif s[i] == 'R':\n\t\t\ta.append(c)\n\t\t\tc = 0\n\t\ti -= 1\n\t\tc += 1\n\tprint(max(a))\n", "R1 = lambda : list(map(int, input().split()))\nR2 = lambda : int(input())\nfor _ in range(R2()):\n\tS = 'R' + input() + 'R'\n\tj = m = 0\n\tfor i in range(len(S)):\n\t\tif S[i] == 'R':\n\t\t\tm = max(m, i - j)\n\t\t\tj = i\n\tprint(m)\n", "num = int(input())\nmax_l = 0\nfor i in range(num):\n\tst = input()\n\tl = 0\n\tfor i in st:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\tif i == 'R':\n\t\t\tif max_l < l:\n\t\t\t\tmax_l = l\n\t\t\t\tl = 0\n\t\t\telse:\n\t\t\t\tl = 0\n\tif max_l < l:\n\t\tmax_l = l\n\t\tl = 0\n\tprint(max_l + 1)\n\tmax_l = 0\n", "t = int(input())\nfor i in range(t):\n\ts = list(input())\n\tcheck = 0\n\tarr = []\n\tarr.append(0)\n\tl = len(s)\n\tfor j in s:\n\t\tif j == 'L':\n\t\t\tcheck = check + 1\n\t\telse:\n\t\t\tarr.append(check)\n\t\t\tcheck = 0\n\tarr.append(check)\n\tprint(max(arr) + 1)\n", "t = int(input())\nfor test in range(t):\n\ta = list(input())\n\tres = 0\n\tcount = 0\n\tfor i in a:\n\t\tcount += 1\n\t\tif i == 'R':\n\t\t\tres = max(res, count)\n\t\t\tcount = 0\n\tres = max(res, count + 1)\n\tprint(res)\n", "def solve(s):\n\t(count, d) = (1, 0)\n\ti = 0\n\twhile i < len(s):\n\t\tif s[i] != 'R':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > d:\n\t\t\t\td = count\n\t\t\tcount = 1\n\t\ti += 1\n\tif count > d:\n\t\td = count\n\treturn d\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tprint(solve(s))\n", "for i in range(int(input())):\n\ts = input()\n\ts = s + 'R'\n\ts = 'R' + s\n\tn = len(s)\n\tlen1 = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == 'R':\n\t\t\tfor j in range(i + 1, n):\n\t\t\t\tif s[j] == 'R':\n\t\t\t\t\tif j - i > len1:\n\t\t\t\t\t\tlen1 = j - i\n\t\t\t\t\tbreak\n\tprint(len1)\n", "def jump(s):\n\tletters = set(s)\n\tif len(letters) == 1:\n\t\tif s[0] == 'L':\n\t\t\treturn len(s) + 1\n\t\treturn 1\n\tmaxi = 0\n\td = 0\n\tfor i in s:\n\t\td += 1\n\t\tif i == 'R':\n\t\t\tif d > maxi:\n\t\t\t\tmaxi = d\n\t\t\td = 0\n\td += 1\n\tif d > maxi:\n\t\tmaxi = d\n\treturn maxi\nt = int(input())\nfor i in range(t):\n\tprint(jump(input()))\n", "def solve(s, size):\n\tback = -1\n\tans = 0\n\tfor i in range(size):\n\t\tif s[i] == 'L' and back == -1:\n\t\t\tback = i\n\t\telif s[i] == 'R' and back != -1:\n\t\t\tans = max(ans, i - back)\n\t\t\tback = -1\n\tif back != -1:\n\t\tans = max(ans, size - back)\n\treturn ans + 1\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tsize = len(s)\n\tprint(solve(s, size))\n", "N = int(input())\nfor _ in range(N):\n\ts = input()\n\tln = 1\n\tnow = s[0]\n\tans = []\n\tfor i in range(1, len(s)):\n\t\tif s[i] == now:\n\t\t\tln += 1\n\t\telse:\n\t\t\tans.append((now, ln))\n\t\t\tln = 1\n\t\t\tnow = s[i]\n\tans.append((now, ln))\n\tmx = 0\n\tfor (dir, ln) in ans:\n\t\tif dir == 'L':\n\t\t\tmx = max(mx, ln)\n\tprint(mx + 1)\n", "col = int(input())\nfor _ in range(col):\n\ts = input()\n\tl = 1\n\tlmax = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tl = 1\n\t\tif l > lmax:\n\t\t\tlmax = l\n\tprint(lmax)\n", "def solve(s):\n\tmax_l_count = 0\n\tl_count = 0\n\tprev_item = s[0]\n\tif prev_item == 'L':\n\t\tl_count += 1\n\t\tmax_l_count = 1\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tl_count += 1\n\t\telse:\n\t\t\tif l_count > max_l_count:\n\t\t\t\tmax_l_count = l_count\n\t\t\tl_count = 0\n\t\tif l_count > max_l_count:\n\t\t\tmax_l_count = l_count\n\treturn str(max_l_count + 1)\nanswers = []\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tanswers.append(solve(s))\nprint('\\n'.join(answers))\n", "for _ in range(int(input())):\n\ta = input()\n\tn = len(a)\n\ti = 0\n\tc = 0\n\twhile i < n:\n\t\tif a[i] == 'L':\n\t\t\tj = i\n\t\t\ttemp = 1\n\t\t\twhile j < n - 1:\n\t\t\t\tif a[j + 1] == 'L':\n\t\t\t\t\ttemp += 1\n\t\t\t\t\tj += 1\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\tif i == j:\n\t\t\t\ti += 1\n\t\t\t\tj += 1\n\t\t\telse:\n\t\t\t\ti = j\n\t\t\tc = max(c, temp)\n\t\telse:\n\t\t\ti += 1\n\tprint(c + 1)\n", "def I():\n\treturn list(map(int, input().split()))\nfor __ in range(int(input())):\n\ts = input()\n\ts += 'R'\n\td = 1\n\ti = len(s) - 1\n\twhile i >= 0:\n\t\tfinal = i\n\t\ti -= 1\n\t\twhile i >= 0 and s[i] != 'R':\n\t\t\ti -= 1\n\t\td = max(d, final - i)\n\tprint(d)\n", "t = int(input())\nwhile t > 0:\n\ts = input().split('R')\n\tprint(max([len(l) for l in s]) + 1)\n\tt -= 1\n", "def solve(path):\n\tprevious = 0\n\tR = []\n\tfor (i, d) in enumerate(path):\n\t\tif d == 'R':\n\t\t\tR.append(i - previous + 1)\n\t\t\tprevious = i + 1\n\treturn max(R + [len(path) - previous + 1])\n[print(solve(input())) for _ in range(int(input()))]\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tjump = 0\n\tstart = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tjump = max(i - start, jump)\n\t\t\tstart = i\n\tjump = max(len(s) - start, jump)\n\tprint(jump)\n", "for _ in range(int(input())):\n\tarr = input()\n\tn = len(arr)\n\td = 0\n\tminimun = 0\n\tfor i in range(n):\n\t\td += 1\n\t\tif arr[i] == 'R':\n\t\t\tif d > minimun:\n\t\t\t\tminimun = d\n\t\t\td = 0\n\t\tif i == n - 1:\n\t\t\tif minimun < d + 1:\n\t\t\t\tminimun = d + 1\n\tprint(minimun)\n", "import sys\n\ndef findMax(x):\n\tn = 0\n\tstart = 0\n\twhile start < len(x):\n\t\td = findFirstR(x, start)\n\t\tif d > n:\n\t\t\tn = d\n\t\tstart = start + d\n\treturn n\n\ndef findFirstR(x, start):\n\tfor i in range(start, len(x)):\n\t\tif x[i] == 'R':\n\t\t\treturn i - start + 1\n\treturn len(x) - start + 1\nlines = sys.stdin.readlines()\nntests = int(lines[0].rstrip())\nfor test in range(ntests):\n\tx = lines[test + 1].rstrip()\n\tprint(findMax(x))\n", "for _ in range(int(input())):\n\tstr = 'L'\n\tstr = str + input()\n\tstr = str + 'R'\n\tm = 1\n\tlastPos = 0\n\tfor i in range(1, len(str)):\n\t\tif str[i] == 'R':\n\t\t\ta = i - lastPos\n\t\t\tif a > m:\n\t\t\t\tm = a\n\t\t\tlastPos = i\n\tprint(m)\n", "n = int(input())\nfor _ in range(n):\n\ts = input()\n\tmax_l = 0\n\tl = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tif max_l < l:\n\t\t\t\tmax_l = l\n\t\t\tl = 0\n\tprint(max(l, max_l) + 1)\n", "def check(n):\n\tglobal s\n\tl = len(s)\n\tarr = [0] * len(s)\n\tfor i in range(l):\n\t\tif s[i] == 'R':\n\t\t\tarr[i] = i + n\n\t\telse:\n\t\t\tarr[i] = arr[i - 1]\n\tptr = n - 1\n\twhile True:\n\t\tif ptr >= l:\n\t\t\treturn 1\n\t\tptr = arr[ptr]\n\t\tif ptr >= l:\n\t\t\treturn 1\n\t\tif arr[ptr] <= ptr:\n\t\t\treturn 0\nfor i in range(int(input())):\n\ts = input()\n\tl = 1\n\tr = len(s) + 1\n\twhile l < r - 1:\n\t\tm = (l + r) // 2\n\t\tif check(m):\n\t\t\tr = m\n\t\telse:\n\t\t\tl = m\n\tif check(l):\n\t\tprint(l)\n\telif check(l + 1):\n\t\tprint(l + 1)\n\telse:\n\t\tprint(r)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tind = [-1]\n\td = []\n\tif all((i == 'L' for i in s)):\n\t\tprint(len(s) + 1)\n\telif all((i == 'L' for i in s)):\n\t\tprint('1')\n\telse:\n\t\tloc = 0\n\t\tfor j in range(len(s)):\n\t\t\tif s[j] == 'R':\n\t\t\t\tind.append(j)\n\t\tind.append(len(s))\n\t\tfor j in range(len(ind) - 1):\n\t\t\tdiff = ind[j + 1] - ind[j]\n\t\t\td.append(diff)\n\t\tprint(max(d))\n", "for T in range(int(input())):\n\ts = input()\n\tcount = 1\n\tmaxi = 1\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\t\tif count > maxi:\n\t\t\t\tmaxi = count\n\t\telse:\n\t\t\tcount = 1\n\tprint(maxi)\n", "for t in range(int(input())):\n\ts = input()\n\tans = 0\n\tprevans = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L' and i == len(s) - 1:\n\t\t\tans += 1\n\t\t\tif ans > prevans:\n\t\t\t\tprevans = ans\n\t\telif s[i] == 'L':\n\t\t\tans += 1\n\t\telif ans > prevans:\n\t\t\tprevans = ans\n\t\t\tans = 0\n\t\telse:\n\t\t\tans = 0\n\tif ans == len(s):\n\t\tprint(ans + 1)\n\telse:\n\t\tprint(prevans + 1)\n", "for _ in range(int(input())):\n\tarray = list(input())\n\tN = len(array)\n\tnearestR = 0\n\tfarthestR = 0\n\tif len(set(array)) == 1 and array[0] == 'L':\n\t\tprint(N + 1)\n\t\tcontinue\n\tfor i in range(N):\n\t\tif array[i] == 'R':\n\t\t\tnearestR = i\n\t\t\tbreak\n\tRdistance = []\n\tfor i in range(N):\n\t\tif array[i] == 'R':\n\t\t\tRdistance.append(i)\n\t\t\tfarthestR = i\n\tmaxdistance = -1\n\tfor i in range(1, len(Rdistance)):\n\t\tif Rdistance[i] - Rdistance[i - 1] > maxdistance:\n\t\t\tmaxdistance = Rdistance[i] - Rdistance[i - 1]\n\tprint(max(nearestR + 1, N - farthestR, maxdistance))\n", "for t in range(int(input())):\n\tstring = input()\n\tultimoR = 0\n\tdistR = 0\n\tflagR = False\n\tfor char in range(len(string)):\n\t\tif string[char] == 'R' and (not flagR):\n\t\t\tflagR = True\n\t\t\tultimoR = char\n\t\t\tdistR = char + 1\n\t\telif string[char] == 'R':\n\t\t\tdistR = max(distR, abs(char - ultimoR))\n\t\t\tultimoR = char\n\tif not flagR:\n\t\tprint(len(string) + 1)\n\telse:\n\t\tpulo = max(distR, abs(len(string) - ultimoR))\n\t\tprint(pulo)\n", "import sys\nt = int(sys.stdin.readline())\nfor _ in range(t):\n\tarr = [0] + list(sys.stdin.readline().strip()) + [0]\n\tR_index = 0\n\td = 0\n\tfor i in range(len(arr)):\n\t\tif R_index == 0 and arr[i] == 'R':\n\t\t\td = i\n\t\t\tR_index = i\n\t\telif arr[i] == 'R':\n\t\t\ttemp = i - R_index\n\t\t\tif d < temp:\n\t\t\t\td = temp\n\t\t\tR_index = i\n\t\telif i == len(arr) - 1:\n\t\t\tif R_index == 0:\n\t\t\t\td = i\n\t\t\telse:\n\t\t\t\ttemp = i - R_index\n\t\t\t\tif d < temp:\n\t\t\t\t\td = temp\n\tprint(d)\n", "def main():\n\tt = 1\n\tt = int(input())\n\tfor _ in range(t):\n\t\ta = input()\n\t\ta = 'R' + a\n\t\ta = a[::-1]\n\t\tlastpos = -1\n\t\tans = 0\n\t\tfor (idx, i) in enumerate(a):\n\t\t\tif i == 'R':\n\t\t\t\tans = max(ans, idx - lastpos)\n\t\t\t\tlastpos = idx\n\t\tprint(ans)\n\treturn\nmain()\n", "import os, sys, bisect, copy\nfrom collections import defaultdict, Counter, deque\nfrom functools import lru_cache\nif os.path.exists('in.txt'):\n\tsys.stdin = open('in.txt', 'r')\nif os.path.exists('out.txt'):\n\tsys.stdout = open('out.txt', 'w')\n\ndef input():\n\treturn sys.stdin.readline()\n\ndef mapi(arg=0):\n\treturn map(int if arg == 0 else str, input().split())\nfor _ in range(int(input())):\n\ts = input().strip()\n\tdist = []\n\tmrk = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tmrk += 1\n\t\telse:\n\t\t\tdist.append(mrk)\n\t\t\tmrk = 0\n\tdist.append(mrk)\n\tif len(s) == s.count('R'):\n\t\tprint(1)\n\telse:\n\t\tprint(max(dist) + 1)\n", "n = int(input())\nfor _ in range(n):\n\ts = input()\n\ts = s.split('R')\n\tans = 0\n\tfor i in s:\n\t\tans = max(len(i), ans)\n\tprint(ans + 1)\n", "def rr():\n\treturn input().rstrip()\n\ndef rri():\n\treturn int(rr())\n\ndef rrl():\n\treturn list(map(int, rr().split()))\n\ndef rrt():\n\treturn tuple(map(int, rr().split()))\nfrom collections import defaultdict\n\ndef mus(d=0):\n\treturn defaultdict(defaultdict(d))\n\ndef ms(x, y, d=0):\n\treturn [[0] * y for i in range(x)]\n\ndef ar(x, d=0):\n\treturn [d] * x\n\ndef ppm(m, n=0, x=0, y=0):\n\tprint('\\n'.join(('\\t'.join((str(m[j][i]) for j in range(y or n))) for i in range(x or n))))\n\ndef ppa(a, n):\n\tprint('\\t'.join(map(str, a[0:n])))\n\ndef ppl(a=0, x=[1]):\n\tx[0] = a or x[0] + 1\n\tprint('-' + '- -' * 14 + '-# ' + str(x[0] - 2) + ' #-' + '- -' * 14 + '-')\n\ndef yn(x):\n\treturn 'YES' if x else 'NO'\nfrom itertools import groupby\n\ndef rnar():\n\treturn (rri(), rrl())\n\ndef r2nar():\n\treturn (rri(), rri(), rrl())\n\ndef read():\n\treturn (rr(),)\n\ndef f_dp(x):\n\tleft_side = min((max(dp[i], abs(i - x)) for i in range(0, x) if arr[i] == 'R'), default=float('inf'))\n\treturn left_side\n\ndef solve(s):\n\tmax_l = 0\n\tfor (key, group) in groupby(s):\n\t\tsize = len(list(group))\n\t\tif key == 'L':\n\t\t\tmax_l = max(max_l, size)\n\tansw = max_l\n\treturn answ + 1\ntest_count = rri()\nfor _ in range(test_count):\n\tinput_data = read()\n\tresult = solve(*input_data)\n\tprint(result)\n", "for _ in range(int(input())):\n\ti = input().split('R')\n\ti.sort(reverse=True)\n\tprint(len(i[0]) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tcount = 0\n\tmax_count = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 0\n\t\tif count > max_count:\n\t\t\tmax_count = count\n\tprint(max_count + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tn = len(s)\n\ttmp = 0\n\tcnt = 0\n\tfor j in range(n):\n\t\tif s[j] == 'L':\n\t\t\ttmp += 1\n\t\telif s[j] == 'R':\n\t\t\tcnt = max(cnt, tmp)\n\t\t\ttmp = 0\n\t\tif j == n - 1:\n\t\t\tcnt = max(cnt, tmp)\n\tprint(cnt + 1)\n", "for t in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tm = 0\n\tindex = -1\n\tfor (i, e) in enumerate(s):\n\t\tif e == 'L':\n\t\t\tcontinue\n\t\tm = max(m, i - index)\n\t\tindex = i\n\tm = max(m, abs(n - index))\n\tprint(m)\n", "n = int(input())\nfor i in range(n):\n\ts = 'R' + input() + 'R'\n\tind = 0\n\tmi = 1\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - ind > mi:\n\t\t\t\tmi = i - ind\n\t\t\tind = i\n\tprint(mi)\n", "t = int(input())\nfor i in range(0, t):\n\ts = input()\n\ts = s.split('R')\n\tm = 0\n\tfor j in s:\n\t\tif len(j) > m:\n\t\t\tm = len(j)\n\tprint(m + 1)\n", "t = int(input())\nfor _ in range(t):\n\tarr = [x for x in input()]\n\tarr = ['R'] + arr\n\tarr.append('R')\n\tbrr = []\n\tdifference = []\n\tfor i in range(len(arr)):\n\t\tif arr[i] == 'R':\n\t\t\tbrr.append(i)\n\tfor i in range(len(brr) - 1):\n\t\tdifference.append(brr[i + 1] - brr[i])\n\tif len(difference) > 0:\n\t\tprint(max(difference))\n\telse:\n\t\tprint(len(arr) - 1)\n", "import sys\nimport math\nimport bisect\n\ndef solve(s):\n\tn = len(s)\n\tmax_val = 0\n\tlast = 0\n\tfor i in range(1, n + 2):\n\t\tif i == n + 1 or s[i - 1] == 'R':\n\t\t\tval = i - last\n\t\t\tlast = i\n\t\t\tmax_val = max(max_val, val)\n\treturn max_val\n\ndef main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\tprint(solve(s))\nmain()\n", "from collections import defaultdict\nt = int(input())\nfor _ in range(t):\n\td = {}\n\td = defaultdict(lambda : 0, d)\n\ts = input()\n\ta = 0\n\tcur = 0\n\tk = 1\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tif k - cur > a:\n\t\t\t\ta = k - cur\n\t\t\tcur = k\n\t\tk += 1\n\tif a == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tif a < len(s) + 1 - cur:\n\t\t\ta = len(s) + 1 - cur\n\t\tprint(a)\n", "t = int(input())\nfor tt in range(t):\n\ts = input()\n\td = 1\n\tx = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tx = max(d, x)\n\t\t\td = 1\n\t\telse:\n\t\t\td += 1\n\tx = max(d, x)\n\tprint(x)\n", "a = int(input())\nfor _ in range(a):\n\tvz = 0\n\tvzmax = 0\n\tarryLR = input()\n\tz = len(arryLR)\n\tfor i in range(z):\n\t\tif arryLR[i] == 'L':\n\t\t\tvz += 1\n\t\telse:\n\t\t\tif vzmax < vz:\n\t\t\t\tvzmax = vz\n\t\t\tvz = 0\n\tif vzmax < vz:\n\t\tvzmax = vz\n\tprint(vzmax + 1)\n", "import sys\ninput = sys.stdin.readline\n\ndef getInt():\n\treturn int(input())\n\ndef getVars():\n\treturn map(int, input().split())\n\ndef getList():\n\treturn list(map(int, input().split()))\n\ndef getStr():\n\treturn input().strip()\nt = getInt()\nfor _ in range(t):\n\ts = getStr()\n\ts += 'R'\n\tres = 0\n\tp = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tres = max(res, i - p)\n\t\t\tp = i\n\tif res == 0:\n\t\tres = len(s) + 1\n\tprint(res)\n", "T = int(input())\nfor _ in range(T):\n\tS = 'R' + input()\n\tL = S.split('R')\n\tseq = max([len(v) for v in L])\n\tprint(seq + 1)\n", "def main():\n\tt = int(input())\n\tfor k in range(t):\n\t\ts = input()\n\t\tpositions = [0]\n\t\tfor (i, jump) in enumerate(s):\n\t\t\tif jump == 'R':\n\t\t\t\tpositions.append(i + 1)\n\t\tpositions.append(len(s) + 1)\n\t\tres = -1\n\t\tfor i in range(len(positions) - 1):\n\t\t\tres = max(res, positions[i + 1] - positions[i])\n\t\tprint(res)\nmain()\n", "t = int(input())\nfor case in range(0, t):\n\ts = 'R' + input() + 'R'\n\tm = 1\n\tlastR = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max([m, i - lastR])\n\t\t\tlastR = i\n\tprint(m)\n", "q = int(input())\nfor t in range(q):\n\ts = input()\n\tmaxl = 0\n\tcurr = 0\n\tfor i in range(s.__len__()):\n\t\tif s[i] == 'L':\n\t\t\tcurr += 1\n\t\telse:\n\t\t\tif curr > maxl:\n\t\t\t\tmaxl = curr\n\t\t\tcurr = 0\n\tif curr > maxl:\n\t\tmaxl = curr\n\tprint(maxl + 1)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tcount = 1\n\tm = 0\n\tfor j in s:\n\t\tif j == 'R':\n\t\t\tif count > m:\n\t\t\t\tm = count\n\t\t\tcount = 0\n\t\tcount += 1\n\tif count > m:\n\t\tm = count\n\tprint(m)\n", "from sys import stdin, stdout\nfrom math import gcd, ceil, sqrt\nii1 = lambda : int(stdin.readline().strip())\nis1 = lambda : stdin.readline().strip()\niia = lambda : list(map(int, stdin.readline().strip().split()))\nisa = lambda : stdin.readline().strip().split()\nmod = 1000000007\nn = ii1()\nfor _ in range(n):\n\tres = 0\n\tp = None\n\ts = is1()\n\tfor (j, i) in enumerate(s):\n\t\tif i == 'L' and p == None:\n\t\t\tp = j\n\t\tif i == 'R' and p != None:\n\t\t\tres = max(res, j - p)\n\t\t\tp = None\n\tif p != None:\n\t\tres = max(res, j - p + 1)\n\tprint(res + 1)\n", "from sys import stdin\nimport math\ninp = lambda : stdin.readline().strip()\nt = int(inp())\nfor _ in range(t):\n\ts = str(inp())\n\tlongL = 0\n\tcurr = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcurr += 1\n\t\tlongL = max(longL, curr)\n\t\tif s[i] == 'R':\n\t\t\tcurr = 0\n\tprint(longL + 1)\n", "t = int(input())\nfor _ in range(t):\n\tstring = 'R' + str(input()) + 'R'\n\tl = len(string)\n\tbefore = 0\n\tret = 0\n\tfor i in range(0, l):\n\t\tif string[i] == 'R':\n\t\t\tret = max(ret, i - before)\n\t\t\tbefore = i\n\tprint(ret)\n", "n = int(input())\nfor _ in range(n):\n\ts = 'R' + str(input()) + 'R'\n\tmax_c = 1\n\tlast_r = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - last_r > max_c:\n\t\t\t\tmax_c = i - last_r\n\t\t\tlast_r = i\n\tprint(max_c)\n", "from math import inf\n\ndef main():\n\ta = list(input())\n\tarr = []\n\tmaxx = 0\n\tmaxxx = 0\n\tfor i in range(len(a)):\n\t\tif a[i] == 'L':\n\t\t\tmaxx += 1\n\t\telif a[i] == 'R':\n\t\t\tmaxxx = max(maxx, maxxx)\n\t\t\tmaxx = 0\n\tmaxxx = max(maxx, maxxx)\n\tprint(maxxx + 1)\nfor _ in range(int(input())):\n\tmain()\n", "n = int(input())\nfor j in range(n):\n\ts = input()\n\tl = 0\n\tc = 0\n\tg = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\t\tif c == len(s) - 1:\n\t\t\t\tg = max(g, l)\n\t\telse:\n\t\t\tif l != 0:\n\t\t\t\tg = max(g, l)\n\t\t\tl = 0\n\t\tc += 1\n\tif g == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(g + 1)\n", "import sys\nimport os\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmod = 10 ** 9 + 7\n\ndef lcm(x, y):\n\treturn x * y / gcd(x, y)\n\ndef fact(x, mod=mod):\n\tans = 1\n\tfor i in range(1, x + 1):\n\t\tans = ans * i % mod\n\treturn ans\n\ndef arr2D(n, m, default=0):\n\tlst = []\n\tfor i in range(n):\n\t\ttemp = [default] * m\n\t\tlst.append(temp)\n\treturn lst\n\ndef sortDictV(x):\n\treturn {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}\n\ndef solve(lst):\n\tn = len(lst)\n\tprev = 0\n\tmaxx = 1\n\tn += 2\n\tlst = 'R' + lst + 'R'\n\tfor i in range(n):\n\t\tif lst[i] == 'R':\n\t\t\tmaxx = max(maxx, i - prev)\n\t\t\tprev = i\n\treturn maxx\nfor _ in range(int(input())):\n\tlst = input()\n\tprint(solve(lst))\n", "def map_len(arr):\n\ttotal = []\n\tfor i in range(len(arr)):\n\t\ttotal.append(len(arr[i]))\n\treturn total\nt = int(input())\nfor i in range(t):\n\tn = input().split('R')\n\tlen_n = map_len(n)\n\tprint(max(len_n) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\ta = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\ta.append(i + 1)\n\ta.append(n + 1)\n\tprint(max([a[i] - a[i - 1] for i in range(1, len(a))]))\n", "def ans(s):\n\ts = 'R' + s + 'R'\n\tidx = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tidx.append(i)\n\tm = 0\n\tfor i in range(len(idx) - 1):\n\t\tdiff = idx[i + 1] - idx[i]\n\t\tif diff > m:\n\t\t\tm = diff\n\tprint(m)\nfor _ in range(int(input())):\n\tans(input())\n", "t = int(input())\n\ndef frogjump(letters):\n\tmaxn = 1\n\tleft = -1\n\tfor r in range(len(letters)):\n\t\tif letters[r] == 'R':\n\t\t\tmaxn = max(maxn, r - left)\n\t\t\tleft = r\n\tr += 1\n\tmaxn = max(maxn, r - left)\n\tprint(maxn)\nfor _ in range(t):\n\tletters = input()\n\tfrogjump(letters)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tflag = ''\n\td = 1\n\tfor j in s:\n\t\tif j == 'L' and flag != 'R':\n\t\t\tflag = 'L'\n\t\telif j == 'R' and flag != 'L':\n\t\t\tflag = 'R'\n\t\telse:\n\t\t\tflag = ''\n\t\t\tbreak\n\tif flag == 'L':\n\t\td = len(s) + 1\n\telif flag == 'R':\n\t\td = 1\n\telse:\n\t\tcount = temp = 0\n\t\tfor k in s:\n\t\t\tif k == 'R':\n\t\t\t\tcount = max(count, temp)\n\t\t\t\ttemp = 0\n\t\t\telse:\n\t\t\t\ttemp += 1\n\t\tcount = max(count, temp)\n\t\td = count + 1\n\tprint(d)\n", "t = int(input())\nfor i in range(t):\n\tl = input().split('R')\n\tlengths = list(map(len, l))\n\tprint(max(lengths) + 1)\n", "test = int(input())\nfor _ in range(test):\n\tstring1 = input()\n\ttemp = [0] * (len(string1) + 2)\n\tdist = 0\n\tmax1 = 0\n\tfor i in range(0, len(string1)):\n\t\tdist += 1\n\t\tif string1[i] == 'R':\n\t\t\tmax1 = max(dist, max1)\n\t\t\tdist = 0\n\tmax1 = max(dist + 1, max1)\n\tprint(max1)\n", "for i in range(int(input())):\n\ts = input()\n\tglobal_L = 0\n\tlocal_L = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tglobal_L = max(local_L, global_L)\n\t\t\tlocal_L = 0\n\t\telse:\n\t\t\tlocal_L += 1\n\tif local_L != 0:\n\t\tglobal_L = max(global_L, local_L)\n\tprint(global_L + 1)\n", "t = int(input())\nfor ooo in range(t):\n\ts = input()\n\tn = len(s)\n\te = -1\n\tw = -1\n\tfor i in range(n):\n\t\tk = s[i]\n\t\tif k == 'R':\n\t\t\te = max(e, i - w)\n\t\t\tw = i\n\tif w == -1:\n\t\tprint(n + 1)\n\telse:\n\t\te = max(n - w, e)\n\t\tprint(e)\n", "n = int(input())\nfor k in range(0, n):\n\ts = input()\n\tmaxL = 0\n\tprev = ''\n\tcur = 0\n\tfor x in range(0, len(s)):\n\t\tif s[x] == 'L':\n\t\t\tcur += 1\n\t\telse:\n\t\t\tcur = 0\n\t\tif cur > maxL:\n\t\t\tmaxL = cur\n\tprint(maxL + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = str(input())\n\tl = []\n\tx = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tx += 1\n\t\t\tcontinue\n\t\tif x != 0:\n\t\t\tl.append(x)\n\t\t\tx = 0\n\tl.append(x)\n\tprint(max(l) + 1)\n", "import re, math, decimal, bisect\n\ndef read():\n\treturn input().strip()\n\ndef iread():\n\treturn int(input().strip())\n\ndef viread():\n\treturn [int(_) for _ in input().strip().split()]\n\ndef round(n):\n\treturn int(n + 0.5)\nDEBUG = 1\n\ndef debug(*args, **kwargs):\n\tif DEBUG:\n\t\tprint(*args, **kwargs)\nt = iread()\nfor _ in range(t):\n\tdirs = read()\n\tlongest = 1\n\tyay = False\n\tcur = 0\n\tfor d in dirs + '$':\n\t\tif yay and d != 'L':\n\t\t\tlongest = max(longest, cur + 1)\n\t\t\tcur = 0\n\t\telif yay and d == 'L':\n\t\t\tcur += 1\n\t\telif d == 'L':\n\t\t\tyay = True\n\t\t\tcur = 1\n\tprint(longest)\n", "for r in [0] * int(input()):\n\tprint(max(map(len, input().split('R'))) + 1)\n", "from itertools import groupby\n\ndef solve(s):\n\td = 1\n\tfor (k, v) in groupby(s):\n\t\tif k == 'L':\n\t\t\tl = len(list(v))\n\t\t\td = max(d, l + 1)\n\treturn d\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tprint(solve(s))\n", "from collections import Counter\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\ta = list(s)\n\ta = [0] + a + [1]\n\tn = len(s)\n\tans = 0\n\ti = 0\n\tj = 0\n\twhile j < n + 1:\n\t\tcount = 1\n\t\tj += 1\n\t\twhile j < n + 1 and a[j] != 'R':\n\t\t\tcount += 1\n\t\t\tj += 1\n\t\tans = max(ans, count)\n\t\ti = j\n\tprint(ans)\n", "t = int(input())\nfor q in range(t):\n\ts = input()\n\tn = len(s)\n\tss = list(set(s))\n\tif len(ss) == 1:\n\t\tif ss[0] == 'L':\n\t\t\tprint(n + 1)\n\t\telse:\n\t\t\tprint(1)\n\t\tcontinue\n\ts += 'R'\n\ts = 'R' + s\n\tgap = 0\n\tlastr = 0\n\tfor x in range(1, n + 2):\n\t\tif s[x] == 'R':\n\t\t\tif x - lastr > gap:\n\t\t\t\tgap = x - lastr\n\t\t\t\tlastr = x\n\t\t\telse:\n\t\t\t\tlastr = x\n\tprint(gap)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tm = 1\n\ti = 1\n\tfor x in s:\n\t\tif x == 'R':\n\t\t\tm = max(i, m)\n\t\t\ti = 1\n\t\telse:\n\t\t\ti += 1\n\telse:\n\t\tm = max(i, m)\n\tprint(m)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tx = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tx.append(i + 1)\n\tx.append(len(s) + 1)\n\tans = 0\n\tfor i in range(1, len(x)):\n\t\tans = max(ans, x[i] - x[i - 1])\n\tprint(ans)\n", "for _ in range(int(input())):\n\ta = list(input())\n\tc = 1\n\tk = 1\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\tk += 1\n\t\telse:\n\t\t\tk = 1\n\t\tc = max(k, c)\n\tprint(c)\n", "t = int(input())\nfor _ in range(t):\n\ts = list(input())\n\tn = len(s)\n\tss = [0]\n\tfor (i, x) in enumerate(s):\n\t\tif x == 'R':\n\t\t\tss.append(i + 1)\n\tss.append(n + 1)\n\tdiff = [ss[i + 1] - ss[i] for i in range(len(ss) - 1)]\n\tprint(max(diff))\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts += 'R'\n\tl = [-1]\n\tmax1 = 0\n\tfor (i, c) in enumerate(s, 0):\n\t\tif c == 'R':\n\t\t\tmax1 = max(max1, i - l[len(l) - 1])\n\t\t\tl.append(i)\n\tprint(max1)\n", "n = int(input())\nfor i in range(n):\n\tch = input()\n\tch = 'R' + ch + 'R'\n\ts = 0\n\tl = []\n\tfor i in range(1, len(ch) - 1):\n\t\tif ch[i] == 'L':\n\t\t\ts += 1\n\t\tif ch[i] == 'R':\n\t\t\tl.append(s)\n\t\t\ts = 0\n\tl.append(s)\n\tk = max(l)\n\tif k == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(k + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tl = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\tma = 0\n\tfor i in range(len(l) - 1):\n\t\tif l[i + 1] - l[i] > ma:\n\t\t\tma = l[i + 1] - l[i]\n\tprint(ma)\n", "list_ans = []\nfor _ in range(int(input())):\n\ts = input()\n\tlist1 = [0]\n\tlist2 = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tlist1.append(i + 1)\n\tlist1.append(len(s) + 1)\n\tfor i in range(len(list1) - 1):\n\t\tlist2.append(list1[i + 1] - list1[i])\n\tlist_ans.append(max(list2))\nfor item in list_ans:\n\tprint(item)\n", "t = int(input())\nwhile t:\n\ts = input()\n\tmdiff = 0\n\tprev = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmdiff = max(mdiff, i - prev)\n\t\t\tprev = i\n\tprint(max(mdiff, len(s) - prev))\n\tt -= 1\n", "for t in range(int(input())):\n\ts = input()\n\tsch = 0\n\tx = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tsch += 1\n\t\telse:\n\t\t\tx += [sch]\n\t\t\tsch = 0\n\tx += [sch]\n\tk = max(x)\n\tprint(k + 1)\n", "for i in range(int(input())):\n\ts = input()\n\ts += 'R'\n\tss = [-1]\n\tans = []\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tans.append(j - ss[-1])\n\t\t\tss.append(j)\n\tprint(max(ans))\n", "q = int(input())\nfor i in range(q):\n\tw = input()\n\tn = 1\n\tmn = 1\n\tfor i in w:\n\t\tif i != 'R':\n\t\t\tmn += 1\n\t\telse:\n\t\t\tif mn > n:\n\t\t\t\tn = mn\n\t\t\tmn = 1\n\tif mn > n:\n\t\tn = mn\n\t\tmn = 1\n\tprint(n)\n", "t = int(input())\nfor _ in range(t):\n\tstring = input()\n\tleft = 0\n\ttemp = 0\n\tfor s in string:\n\t\tif s == 'L':\n\t\t\ttemp += 1\n\t\t\tleft = max(left, temp)\n\t\telse:\n\t\t\ttemp = 0\n\tprint(left + 1)\n", "import math\nfrom bisect import bisect_left, bisect_right\nfrom sys import stdin, stdout\nfrom collections import Counter\ninput = lambda : stdin.readline().strip()\nprint = stdout.write\nT = int(input())\nfor i in range(T):\n\ts = input()\n\ti = 0\n\tm = 0\n\twhile i < len(s):\n\t\tcnt = 0\n\t\twhile i < len(s) and s[i] == 'L':\n\t\t\tcnt += 1\n\t\t\ti += 1\n\t\twhile i < len(s) and s[i] == 'R':\n\t\t\ti += 1\n\t\tm = max(m, cnt)\n\tprint(str(m + 1) + '\\n')\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tmaiorL = 0\n\taux = 'LL'\n\tL = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tL += 1\n\t\telse:\n\t\t\tif L > maiorL:\n\t\t\t\tmaiorL = L\n\t\t\tL = 0\n\tif L > maiorL:\n\t\tmaiorL = L\n\tprint(maiorL + 1)\n", "def solve(s):\n\treturn max((len(ss) for ss in s.split('R'))) + 1\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tprint(solve(s))\n", "for i in range(int(input())):\n\ta = input()\n\ts = 0\n\tb = []\n\tif set(a) == {'L'}:\n\t\tprint(a.count('L') + 1)\n\telse:\n\t\tfor i in a:\n\t\t\tif i == 'R':\n\t\t\t\tb.append(s)\n\t\t\t\ts = 0\n\t\t\telse:\n\t\t\t\ts += 1\n\t\tb.append(s)\n\t\tprint(max(b) + 1)\n", "import sys\ninput = sys.stdin.readline\nfrom math import *\nt = int(input())\na = []\nwhile t > 0:\n\tt -= 1\n\ts = list(input().rstrip())\n\tn = len(s)\n\td = []\n\tflag = 0\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\td.append(i + 1)\n\td.insert(0, 0)\n\td.append(n + 1)\n\tmaxi = -999\n\tif len(d) == 2:\n\t\tprint(n + 1)\n\t\tcontinue\n\tfor i in range(1, len(d)):\n\t\tmaxi = max(maxi, d[i] - d[i - 1])\n\tprint(maxi)\n", "from math import sqrt\nfrom collections import defaultdict\nt = int(input())\nwhile t:\n\tt = t - 1\n\ta = list(input())\n\tind = defaultdict(list)\n\tfor (i, tmp) in enumerate(a):\n\t\tind[tmp].append(i + 1)\n\tif 'R' not in ind:\n\t\tprint(len(a) + 1)\n\t\tcontinue\n\tif 'L' not in ind:\n\t\tprint(1)\n\t\tcontinue\n\tind['R'].append(len(a) + 1)\n\tind['R'].sort()\n\tstart = 0\n\tans = 0\n\tfor i in ind['R']:\n\t\tans = max(ans, i - start)\n\t\tstart = i\n\tprint(ans)\n", "x = int(input())\nfor a in range(0, x):\n\ty = input()\n\tl = 0\n\tls = 0\n\tfor b in range(0, len(y)):\n\t\tif y[b] == 'R':\n\t\t\tls = max(ls, l)\n\t\t\tl = 0\n\t\telse:\n\t\t\tl += 1\n\tls = max(ls, l)\n\tprint(ls + 1)\n", "def ans(l):\n\tprint(max(l) + 1)\nfor _ in range(int(input())):\n\ts = input()\n\tss = s.split('R')\n\tl = list(map(len, ss))\n\tans(l)\n", "test_case = int(input())\nwhile test_case:\n\ttest_case -= 1\n\tstring = input() + 'R'\n\tprev = -1\n\tres = 0\n\tfor (idx, x) in enumerate(string):\n\t\tif x == 'R':\n\t\t\tres = max(res, idx - prev)\n\t\t\tprev = idx\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tarr = []\n\tma = -10000000\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif len(arr) != 0:\n\t\t\t\tdiff = i - arr[-1]\n\t\t\t\tif diff > ma:\n\t\t\t\t\tma = diff\n\t\t\telse:\n\t\t\t\tdiff = i + 1\n\t\t\tif diff > ma:\n\t\t\t\tma = diff\n\t\t\tarr.append(i)\n\tif len(arr) == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tdiff = len(s) - arr[-1]\n\t\tif diff > ma:\n\t\t\tma = diff\n\t\tarr.append(len(s))\n\t\tprint(ma)\n", "a = int(input())\nletters = ['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']\nfor i in range(a):\n\tstring = input()\n\tmax1 = 0\n\tc = 0\n\tfor j in string:\n\t\tif j == 'R':\n\t\t\tc = 0\n\t\telse:\n\t\t\tc = c + 1\n\t\t\tif c > max1:\n\t\t\t\tmax1 = c\n\tprint(max1 + 1)\n", "import sys\nimport math\nimport heapq\nimport collections\n\ndef inputnum():\n\treturn int(input())\n\ndef inputnums():\n\treturn map(int, input().split())\n\ndef inputlist():\n\treturn list(map(int, input().split()))\n\ndef inputstring():\n\treturn [x for x in input()]\n\ndef inputmatrixchar(rows):\n\tarr2d = [[j for j in input().strip()] for i in range(rows)]\n\treturn arr2d\n\ndef inputmatrixint(rows):\n\tarr2d = []\n\tfor _ in range(rows):\n\t\tarr2d.append([int(i) for i in input().split()])\n\treturn arr2d\nt = int(input())\nfor q in range(t):\n\ts = inputstring()\n\tr = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(len(s) + 1)\n\tmx = r[1] - r[0]\n\tfor i in range(2, len(r)):\n\t\tmx = max(r[i] - r[i - 1], mx)\n\tprint(mx)\n", "t = int(input())\nfor _ in range(t):\n\ts = input().strip()\n\td = 1\n\tans = 0\n\tfor i in reversed(range(len(s))):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, d)\n\t\t\td = 1\n\t\telse:\n\t\t\td += 1\n\tans = max(ans, d)\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tn = 0\n\tm = -1\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tn += 1\n\t\telse:\n\t\t\tm = max(m, n)\n\t\t\tn = 0\n\tprint(m + 1)\n", "from collections import Counter\nfrom collections import defaultdict\nimport math\nimport random\nimport heapq as hq\nfrom math import sqrt\nimport sys\nfrom functools import reduce\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef iinput():\n\treturn int(input())\n\ndef tinput():\n\treturn input().split()\n\ndef rinput():\n\treturn map(int, tinput())\n\ndef rlinput():\n\treturn list(rinput())\nmod = int(1000000000.0) + 7\n\ndef factors(n):\n\treturn set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))\nfor _ in range(iinput()):\n\ts = input()\n\tn = len(s)\n\ts = 'R' + s + 'R'\n\tmx = 0\n\tprev = 0\n\tfor i in range(1, n + 2):\n\t\tif s[i] == 'R':\n\t\t\tmx = max(mx, i - prev)\n\t\t\tprev = i\n\tprint(mx)\n", "t = int(input())\nwhile t != 0:\n\tn = list(input())\n\ti = 0\n\tmaxi = 0\n\twhile i < len(n):\n\t\tif n[i] == 'L':\n\t\t\tcount = 0\n\t\t\twhile i < len(n) and n[i] == 'L':\n\t\t\t\tcount += 1\n\t\t\t\ti += 1\n\t\t\tif count > maxi:\n\t\t\t\tmaxi = count\n\t\telse:\n\t\t\ti += 1\n\tprint(maxi + 1)\n\tt -= 1\n", "t = int(input())\nfor _ in range(0, t):\n\ts = input()\n\tmax = 1\n\tcurrent = 1\n\tfor (i, j) in enumerate(s):\n\t\tif j == 'L':\n\t\t\tcurrent += 1\n\t\t\tif current > max:\n\t\t\t\tmax = current\n\t\telse:\n\t\t\tcurrent = 1\n\tprint(max)\n", "a = int(input())\nfor k in range(a):\n\tb = input()\n\tt = len(b)\n\tif b.count('L') == t:\n\t\tprint(t + 1)\n\telif b.count('R') == t:\n\t\tprint(1)\n\telse:\n\t\tmax1 = 0\n\t\tf = 0\n\t\tfor i in range(t):\n\t\t\tif b[i] == 'L':\n\t\t\t\tf += 1\n\t\t\telse:\n\t\t\t\tif max1 < f:\n\t\t\t\t\tmax1 = f\n\t\t\t\tf = 0\n\t\tif max1 < f:\n\t\t\tmax1 = f\n\t\tprint(max1 + 1)\n", "for _ in range(int(input())):\n\tdebug = False\n\tpath = input()\n\tn = len(path)\n\tpath = 'R' + path + 'R'\n\tprevPos = 0\n\td = float('-inf')\n\tfor i in range(1, n + 2):\n\t\tif path[i] == 'R':\n\t\t\tif debug:\n\t\t\t\tprint(i)\n\t\t\t\tprint('\\t\\td before', d)\n\t\t\td = max(d, i - prevPos)\n\t\t\tif debug:\n\t\t\t\tprint('\\t\\td after', d)\n\t\t\tprevPos = i\n\tprint(d)\n", "n = int(input())\nfor i in range(n):\n\tcnt = 1\n\tmax_cnt = 1\n\tpre_s = input()\n\ts = 'R' + pre_s + 'R'\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcnt += 1\n\t\t\tmax_cnt = max(max_cnt, cnt)\n\t\tif i == 'R':\n\t\t\tcnt = 1\n\tprint(max_cnt)\n", "import collections\n\ndef solve(string):\n\tn = len(string)\n\trPositions = [0]\n\tfor (i, ch) in enumerate(string, 1):\n\t\tif ch == 'R':\n\t\t\trPositions.append(i)\n\trPositions.append(n + 1)\n\td = 0\n\tfor i in range(len(rPositions) - 1):\n\t\td = max(d, rPositions[i + 1] - rPositions[i])\n\treturn d\nt = int(input().strip())\nfor i in range(t):\n\tstring = input().strip()\n\tprint(solve(string))\n", "T = int(input())\nfor t in range(T):\n\tS = input()\n\tans = 0\n\tc = 0\n\tfor s in S:\n\t\tc += 1\n\t\tif s == 'R':\n\t\t\tans = max(ans, c)\n\t\t\tc = 0\n\tc += 1\n\tans = max(ans, c)\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tans = [-1]\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans.append(i)\n\tans.append(n)\n\tb = []\n\tfor i in range(1, len(ans)):\n\t\tb.append(ans[i] - ans[i - 1])\n\tprint(max(b))\n", "t = int(input())\nfor i in range(t):\n\ts = 'R' + input() + 'R'\n\td = 0\n\tgap = 0\n\tfor c in s:\n\t\tif c == 'R':\n\t\t\tgap = 0\n\t\telse:\n\t\t\tgap += 1\n\t\t\td = max(gap, d)\n\tprint(d + 1)\n", "for i in range(int(input())):\n\tx = str(input())\n\tMax = 0\n\ty = [0]\n\tfor j in range(len(x)):\n\t\tif x[j] == 'R':\n\t\t\ty.append(j + 1)\n\tfor k in range(len(y) - 1):\n\t\tif y[k + 1] - y[k] > Max:\n\t\t\tMax = y[k + 1] - y[k]\n\tprint(max(Max, len(x) + 1 - max(y), min(y)))\n", "import sys\ninput = sys.stdin.readline\nfor j in range(int(input())):\n\ta = input()\n\ta = a + 'R'\n\tans = 1\n\tcount = 0\n\tfor j in a:\n\t\tif j == 'L':\n\t\t\tcount = count + 1\n\t\telse:\n\t\t\tcount = count + 1\n\t\t\tif count > ans:\n\t\t\t\tans = count\n\t\t\tcount = 0\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tpos = []\n\ti = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tif len(pos) == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tpos.append(len(s) + 1)\n\t\tdiff = [pos[0]]\n\t\tfor i in range(len(pos) - 1):\n\t\t\tdiff.append(pos[i + 1] - pos[i])\n\t\tprint(max(diff))\n", "import math\nfor i in range(0, int(input())):\n\ts = input()\n\tmax_ = 0\n\tpos = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif max_ < i + 1 - pos:\n\t\t\t\tmax_ = i + 1 - pos\n\t\t\tpos = i + 1\n\tif max_ < len(s) + 1 - pos:\n\t\tmax_ = len(s) + 1 - pos\n\tprint(max_)\n", "for _ in range(int(input())):\n\ts = str(input())\n\tc = 0\n\tans = 0\n\tfor i in range(len(s)):\n\t\tif s[i] != 'R':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 1\n\t\t\tans = max(c, ans)\n\t\t\tc = 0\n\tc += 1\n\tans = max(c, ans)\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\ntests = inp()\ntestcount = 0\nwhile testcount < tests:\n\tseq = insr()\n\ti = 0\n\tarr = []\n\tcount = 0\n\twhile i < len(seq):\n\t\tif seq[i] == 'L':\n\t\t\tcount += 1\n\t\t\ti += 1\n\t\t\tif i == len(seq):\n\t\t\t\tarr.append(count)\n\t\telse:\n\t\t\tarr.append(count)\n\t\t\tcount = 0\n\t\t\ti += 1\n\tprint(max(arr) + 1)\n\ttestcount += 1\n", "def solution(s):\n\td = 0\n\tl = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td = max(d, i - l)\n\t\t\tl = i\n\td = max(d, len(s) - l)\n\treturn d\n\ndef main():\n\tt = eval(input())\n\tfor _ in range(t):\n\t\ts = input()\n\t\tprint(solution(s))\nmain()\n", "from collections import defaultdict\nt = int(input())\nfor _ in range(t):\n\ts = input() + 'R'\n\tcurrent = 1\n\tsteps = 0\n\tfor (i, c) in enumerate(s):\n\t\tif c == 'R':\n\t\t\tsteps = max(steps, current)\n\t\t\tcurrent = 1\n\t\telse:\n\t\t\tcurrent += 1\n\tprint(steps)\n", "def run(s):\n\ts += 'R'\n\tmax_run = 0\n\tcurrent_run = 1\n\tfor c in s:\n\t\tif c == 'R':\n\t\t\tmax_run = max(max_run, current_run)\n\t\t\tcurrent_run = 1\n\t\telse:\n\t\t\tcurrent_run += 1\n\treturn max_run\ntestcase = int(input())\nfor _ in range(testcase):\n\ts = input()\n\tans = run(s)\n\tprint(ans)\n", "def find_d(s):\n\ts = 'R' + s + 'R'\n\t_max_ = 1\n\tcounter = 1\n\tfor symbol in s:\n\t\tif symbol == 'R':\n\t\t\tif _max_ < counter:\n\t\t\t\t_max_ = counter\n\t\t\tcounter = 1\n\t\telse:\n\t\t\tcounter += 1\n\tprint(_max_)\nn = int(input())\nfor _ in range(n):\n\ts = input()\n\tfind_d(s)\n", "t = int(input())\nwhile t > 0:\n\ts = input()\n\tflag = 0\n\tdp = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tflag += 1\n\t\t\tif i == len(s) - 1:\n\t\t\t\tdp.append(flag)\n\t\telse:\n\t\t\tdp.append(flag)\n\t\t\tflag = 0\n\tprint(max(dp) + 1)\n\tt -= 1\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\ts = input()\n\tm = 0\n\tc = 1\n\tp = s[0]\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > m:\n\t\t\t\tm = c\n\t\t\tc = 1\n\tif c > m:\n\t\tm = c\n\tprint(m)\n", "for _ in range(int(input())):\n\ts = input()\n\tarr = []\n\tcnt = 0\n\tif s[0] == 'L':\n\t\ti = 0\n\t\twhile i < len(s) and s[i] == 'L':\n\t\t\ti += 1\n\t\tarr.append(i)\n\t\tfor j in range(i, len(s) - 1):\n\t\t\tif s[j] == s[j + 1] == 'L':\n\t\t\t\tcnt += 1\n\t\t\telif s[j] != s[j + 1]:\n\t\t\t\tarr.append(cnt + 1)\n\t\t\t\tcnt = 0\n\t\tif s[-1] == 'L':\n\t\t\tarr.append(cnt + 1)\n\t\telse:\n\t\t\tarr.append(cnt)\n\telse:\n\t\tfor i in range(len(s) - 1):\n\t\t\tif s[i] == s[i + 1] == 'L':\n\t\t\t\tcnt += 1\n\t\t\telif s[i] != s[i + 1]:\n\t\t\t\tarr.append(cnt + 1)\n\t\t\t\tcnt = 0\n\t\tif s[-1] == 'L':\n\t\t\tarr.append(cnt + 1)\n\t\telse:\n\t\t\tarr.append(cnt)\n\tprint(max(arr) + 1)\n", "data = []\nn = int(input())\nfor i in range(n):\n\tdata.append(input())\n\ndef count_max(path):\n\tm = 0\n\tc = 0\n\tfor i in path:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > m:\n\t\t\t\tm = c\n\t\t\tc = 0\n\treturn m + 1 if c < m else c + 1\nfor i in data:\n\tprint(count_max(i))\n", "MOD = 1000000007\nii = lambda : int(input())\nsi = lambda : input()\ndgl = lambda : list(map(int, input()))\nf = lambda : map(int, input().split())\nil = lambda : list(map(int, input().split()))\nls = lambda : list(input())\nfrom collections import *\nfor _ in range(ii()):\n\ts = si()\n\tl = []\n\tx = []\n\tc = 0\n\tp = list(s)\n\tp.insert(0, 0)\n\tp.append(1)\n\tfor i in range(0, len(p)):\n\t\tif p[i] == 'R' or p[i] == 1 or p[i] == 0:\n\t\t\tl.append(i)\n\t\t\tc = c + 1\n\tif c == 0:\n\t\tprint(len(s))\n\telif s.find('R') == -1:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tfor i in range(1, len(l)):\n\t\t\tx.append(l[i] - l[i - 1])\n\t\tprint(max(x))\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tcurm = 0\n\tma = 0\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tcurm += 1\n\t\telse:\n\t\t\tif curm > ma:\n\t\t\t\tma = curm\n\t\t\tcurm = 0\n\tif curm > ma:\n\t\tma = curm\n\tprint(ma + 1)\n", "t = int(input())\nwhile t:\n\tt = t - 1\n\tst = [s for s in input()]\n\tst.append('F')\n\tst.insert(0, 'R')\n\tis_r = -1\n\tn = len(st)\n\tx = []\n\tlast = n - 1\n\tfor i in range(n - 1, -1, -1):\n\t\tif st[i] == 'R':\n\t\t\tx.append(last - i)\n\t\t\tlast = i\n\tprint(max(x))\n", "import os\nfrom io import BytesIO, IOBase\nimport sys\nfrom collections import defaultdict, deque, Counter\nfrom bisect import *\nfrom math import sqrt\nimport math\nfrom itertools import permutations\n\ndef main():\n\tfor t in range(int(input())):\n\t\ts = input().rstrip()\n\t\tn = len(s)\n\t\tr = [0]\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tr.append(i + 1)\n\t\tr.append(n + 1)\n\t\tma = 0\n\t\tfor i in range(len(r) - 1):\n\t\t\tma = max(ma, r[i + 1] - r[i])\n\t\tprint(ma)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tpos = []\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tpos.append(i)\n\td = 0\n\tif len(pos) == 0:\n\t\tprint(len(s) + 1)\n\telif len(pos) == 1:\n\t\tprint(max(pos[0] + 1, n - pos[0]))\n\telse:\n\t\tfor i in range(len(pos)):\n\t\t\tif i == 0:\n\t\t\t\td = max(d, pos[i] + 1)\n\t\t\telif i == len(pos) - 1 and i is not 0:\n\t\t\t\td = max(d, n - pos[i], pos[i] - pos[i - 1])\n\t\t\telse:\n\t\t\t\td = max(d, pos[i] - pos[i - 1])\n\t\tprint(d)\n", "t = int(input())\nfor _ in range(t):\n\tA = input()\n\tcounter = 0\n\tmax_counter = 0\n\tfor i in range(len(A)):\n\t\tif A[i] == 'L':\n\t\t\tcounter += 1\n\t\telse:\n\t\t\tcounter = 0\n\t\tif counter > max_counter:\n\t\t\tmax_counter = counter\n\tprint(max_counter + 1)\n", "n = int(input())\nfor i in range(n):\n\tt = input().strip()\n\tprint(max([len(v) for v in t.split('R')]) + 1)\n", "def main():\n\tglobal STR, N, WAS\n\tcnt = int(input())\n\tfor i in range(cnt):\n\t\tSTR = 'R' + input()\n\t\tN = len(STR)\n\t\tmstep = 0\n\t\tt = 0\n\t\tfor i in range(N - 1, -1, -1):\n\t\t\tif STR[i] == 'R':\n\t\t\t\tt = i\n\t\t\t\tbreak\n\t\tmstep = N - t\n\t\tif mstep < N:\n\t\t\tfor i in range(t, -2, -1):\n\t\t\t\tif i == -1:\n\t\t\t\t\tprint(mstep)\n\t\t\t\t\tbreak\n\t\t\t\tif STR[i] == 'R':\n\t\t\t\t\tmstep = max(t - i, mstep)\n\t\t\t\t\tt = i\n\t\telse:\n\t\t\tprint(mstep)\nmain()\n", "t = int(input())\nfor i in range(t):\n\tinp = input()\n\tcnt = 0\n\tmaxi = 0\n\tfor j in range(len(inp)):\n\t\tif inp[j] == 'L':\n\t\t\tcnt += 1\n\t\t\tmaxi = max(maxi, cnt)\n\t\telse:\n\t\t\tcnt = 0\n\tprint(maxi + 1)\n", "q = int(input())\nfor i in range(q):\n\ta = input()\n\tmaxi = len(a) + 1\n\tmini = -1\n\tc = []\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tc.append(i + 1)\n\tif len(c) == 0:\n\t\tprint(len(a) + 1)\n\telse:\n\t\tmini = -1\n\t\td = []\n\t\td.append(c[0])\n\t\tif len(c) == 1:\n\t\t\td.append(maxi - c[0])\n\t\telse:\n\t\t\tfor i in range(len(c)):\n\t\t\t\tif i == len(c) - 1:\n\t\t\t\t\td.append(maxi - c[i])\n\t\t\t\telse:\n\t\t\t\t\td.append(c[i + 1] - c[i])\n\t\tfor i in d:\n\t\t\tif i > mini:\n\t\t\t\tmini = i\n\t\tprint(mini)\n", "for _ in range(int(input())):\n\ts = input()\n\tc = 0\n\tans = 0\n\tf = 0\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tif f == 0:\n\t\t\t\tc = 1\n\t\t\t\tf = 1\n\t\t\telse:\n\t\t\t\tc += 1\n\t\telse:\n\t\t\tf = 0\n\t\t\tans = max(ans, c)\n\t\t\tc = 0\n\tif c != 0:\n\t\tans = max(ans, c)\n\t\tc = 0\n\tprint(ans + 1)\n", "t = int(input())\nfor case_num in range(t):\n\ts = input()\n\ts2 = 'R' + s + 'R'\n\ta = []\n\tfor i in range(len(s2)):\n\t\tif s2[i] == 'R':\n\t\t\ta.append(i)\n\tans = 1\n\tfor i in range(len(a) - 1):\n\t\tans = max(ans, a[i + 1] - a[i])\n\tprint(ans)\n", "import collections\nfor _ in range(int(input())):\n\ts = input() + 'R'\n\tpre = -1\n\tMAX = 0\n\tfor (i, x) in enumerate(s):\n\t\tif x == 'R':\n\t\t\tMAX = max(MAX, i - pre)\n\t\t\tpre = i\n\tprint(MAX)\n", "t = int(input())\nfor i in range(0, t):\n\ts = input()\n\tl = len(s)\n\td = 1\n\tinitialpos = -1\n\tfor k in range(0, l):\n\t\tif s[k] == 'R':\n\t\t\tif k - initialpos > d:\n\t\t\t\td = k - initialpos\n\t\t\tinitialpos = k\n\t\tif k == l - 1:\n\t\t\tif l - initialpos > d:\n\t\t\t\td = l - initialpos\n\tprint(d)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tn = len(s)\n\tif 'R' not in s:\n\t\tprint(n + 1)\n\telse:\n\t\tprev = -1\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tans = max(ans, i - prev)\n\t\t\t\tprev = i\n\t\tans = max(ans, n - prev)\n\t\tprint(ans)\n", "t = int(input())\nfor you in range(t):\n\tl = input()\n\tli = [0]\n\tfor i in range(len(l)):\n\t\tif l[i] == 'R':\n\t\t\tli.append(i + 1)\n\tli.append(len(l) + 1)\n\tlo = []\n\tfor i in range(len(li) - 1):\n\t\tlo.append(li[i + 1] - li[i])\n\tprint(max(lo))\n", "def run():\n\ts = input()\n\tst = 0\n\tmx = 0\n\twhile st < len(s):\n\t\tif s[st] == 'R':\n\t\t\tst += 1\n\t\telse:\n\t\t\ten = st + 1\n\t\t\twhile en < len(s) and s[en] == 'L':\n\t\t\t\ten += 1\n\t\t\tmx = max(mx, en - st)\n\t\t\tst = en\n\tprint(mx + 1)\ntt = int(input())\nwhile tt > 0:\n\ttt -= 1\n\trun()\n", "for _ in [0] * int(input()):\n\tstr = input()\n\ta = 1\n\taray = []\n\tfor j in str:\n\t\tif j == 'L':\n\t\t\ta += 1\n\t\telse:\n\t\t\tif a:\n\t\t\t\taray.append(a)\n\t\t\ta = 1\n\tif a:\n\t\taray.append(a)\n\tprint(max(aray))\n", "t = int(input())\nfor _ in range(t):\n\tst = input()\n\t(d, i, flag) = (1, 0, 0)\n\twhile i < len(st):\n\t\tif st[i] == 'L':\n\t\t\tflag = 1\n\t\t\tj = i + 1\n\t\t\tp = 1\n\t\t\twhile j < len(st) and st[j] == 'L':\n\t\t\t\tp += 1\n\t\t\t\tj += 1\n\t\t\td = p if p > d else d\n\t\t\ti += j - i - 1\n\t\ti += 1\n\tprint(d + 1) if flag else print(d)\n", "t = int(input())\nfor _ in range(t):\n\ts = str(input())\n\t(p1, p2) = (0, -1)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - p2 > p1:\n\t\t\t\tp1 = i - p2\n\t\t\tp2 = i\n\t\telse:\n\t\t\tp1 = p1\n\tif p1 == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tprint(max(p1, len(s) - p2))\n", "for _ in range(int(input())):\n\ts = input()\n\tcou = 0\n\tcou1 = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif cou > cou1:\n\t\t\t\tcou1 = cou\n\t\t\tcou = 0\n\t\telif s[i] == 'L':\n\t\t\tcou += 1\n\tif cou > cou1:\n\t\tcou1 = cou\n\tprint(cou1 + 1)\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\nfor _ in range(int(input())):\n\ta = [i for i in input()]\n\tind = [-1]\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tind.append(i)\n\tind.append(len(a))\n\tmaxx = 0\n\tfor i in range(1, len(ind)):\n\t\tmaxx = max(maxx, ind[i] - ind[i - 1])\n\tprint(maxx)\n", "for _ in range(int(input())):\n\ts = input()\n\tli = [0]\n\tfor (i, j) in enumerate(s, 1):\n\t\tif j == 'R':\n\t\t\tli.append(i)\n\tli.append(len(s) + 1)\n\tans = 0\n\tfor i in range(1, len(li)):\n\t\tans = max(ans, li[i] - li[i - 1])\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tjumps = input()\n\tdist = []\n\tR = 0\n\tn = len(jumps)\n\tfor i in range(n):\n\t\tif jumps[i] == 'R':\n\t\t\tdist.append(i + 1 - R)\n\t\t\tR = i + 1\n\tdist.append(n + 1 - R)\n\tprint(max(dist))\n", "t = int(input())\nfor i in range(t):\n\ts = list(input())\n\tif 'L' not in s:\n\t\tprint(1)\n\t\tcontinue\n\telse:\n\t\tm = 0\n\t\tcount = 0\n\t\tfor i in range(len(s)):\n\t\t\tcount += 1\n\t\t\tif s[i] == 'R':\n\t\t\t\tif count > m:\n\t\t\t\t\tm = count\n\t\t\t\tcount = 0\n\t\tif count >= m:\n\t\t\tm = count + 1\n\t\tprint(m)\n", "n = int(input())\nfor x in range(n):\n\ts = str(input())\n\til = 0\n\tmxl = 0\n\tfor y in range(0, len(s)):\n\t\tif s[y] == 'L':\n\t\t\til += 1\n\t\telse:\n\t\t\tif il >= mxl:\n\t\t\t\tmxl = il + 1\n\t\t\til = 0\n\tif il >= mxl:\n\t\tmxl = il + 1\n\tprint(mxl)\n", "def run():\n\ts = 'R' + input() + 'R'\n\tflag = 0\n\tans = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\ttemp = i - flag\n\t\t\tans = max(ans, temp)\n\t\t\tflag = i\n\tprint(ans)\nfor i in range(int(input())):\n\trun()\n", "T = int(input())\nfor z in range(T):\n\tA = str(input())\n\tN = len(A)\n\tc = 1\n\ttmp = 0\n\tfor i in range(N):\n\t\tif A[i] == 'L':\n\t\t\ttmp = tmp + 1\n\t\telse:\n\t\t\tif tmp + 1 > c:\n\t\t\t\tc = tmp + 1\n\t\t\ttmp = 0\n\tif tmp + 1 > c:\n\t\tc = tmp + 1\n\tprint(c)\n", "t = int(input())\ni = 0\nwhile i < t:\n\tn = input()\n\tm = len(n)\n\tcount = 0\n\tans = 0\n\tfor x in n:\n\t\tif x == 'L':\n\t\t\tcount = count + 1\n\t\telif x == 'R':\n\t\t\tcount = count + 1\n\t\t\tans = max(ans, count)\n\t\t\tcount = 0\n\tcount = count + 1\n\tans = max(ans, count)\n\tprint(ans)\n\ti = i + 1\n", "import sys\nimport heapq\ninput = sys.stdin.readline\nfrom collections import Counter, defaultdict\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef main():\n\tchars = input().strip()\n\tprev = -1\n\tmi_n = 0\n\tfor i in range(len(chars)):\n\t\tif chars[i] == 'R':\n\t\t\tmi_n = max(mi_n, i - prev)\n\t\t\tprev = i\n\tif prev == -1:\n\t\tprint(len(chars) + 1)\n\telse:\n\t\tprint(max(mi_n, len(chars) - prev))\nt = inp()\nfor _ in range(t):\n\tmain()\n", "t = int(input())\nfor i in range(t):\n\tS = list(input())\n\tmaxstep = 0\n\tcount = 0\n\tfor elem in S:\n\t\tif elem == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > maxstep:\n\t\t\t\tmaxstep = count\n\t\t\tcount = 0\n\telse:\n\t\tif S.pop() == 'L':\n\t\t\tif count > maxstep:\n\t\t\t\tmaxstep = count\n\tprint(maxstep + 1)\n", "def inp_n():\n\treturn int(input())\n\ndef inp_list():\n\treturn list(map(int, input().split()))\n\ndef inp_mul_num():\n\treturn map(int, input().split())\n\ndef is_odd(n):\n\tif n & 1:\n\t\treturn True\n\treturn False\n\ndef is_prime(n):\n\ti = 2\n\twhile i * i <= n:\n\t\tif n % i == 0:\n\t\t\treturn False\n\t\ti += 1\n\treturn True\nfrom collections import defaultdict\nimport math\nfor _ in range(inp_n()):\n\tn = input()\n\tl = len(n)\n\tc = -1\n\tm = 0\n\tfor i in range(0, l):\n\t\tif n[i] == 'R':\n\t\t\tm = max(m, i - c)\n\t\t\tc = i\n\tm = max(m, l - c)\n\tprint(m)\n", "t = int(input())\nfor tt in range(t):\n\ts = input()\n\tn = len(s)\n\ta = [0]\n\tfor x in range(n):\n\t\tif s[x] == 'R':\n\t\t\ta.append(x + 1)\n\ta.append(n + 1)\n\tm = len(a) - 1\n\tc = []\n\tfor x in range(m):\n\t\tc.append(a[x + 1] - a[x])\n\tprint(max(c))\n", "from sys import stdin\nt = int(input())\nfor _ in range(t):\n\t(seq,) = stdin.readline().split()\n\tseq += 'R'\n\tseq = 'R' + seq\n\trights = []\n\tfor s in range(len(seq)):\n\t\tif seq[s] == 'R':\n\t\t\trights.append(s)\n\tmax_dif = 0\n\tfor i in range(len(rights) - 1):\n\t\tif rights[i + 1] - rights[i] > max_dif:\n\t\t\tmax_dif = rights[i + 1] - rights[i]\n\tprint(max_dif)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\td = 1\n\tinternal = 1\n\tfor cell in s:\n\t\tif cell == 'R':\n\t\t\tinternal = 1\n\t\telse:\n\t\t\tinternal += 1\n\t\td = max(internal, d)\n\tprint(d)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tn = len(s)\n\tMax = 0\n\tlocal = 0\n\tfor j in range(n):\n\t\tif s[j] == 'L':\n\t\t\tlocal += 1\n\t\telse:\n\t\t\tMax = max(Max, local)\n\t\t\tlocal = 0\n\tMax = max(Max, local)\n\tprint(Max + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tcount = 0\n\tmini = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount += 1\n\t\t\tmini = max(count, mini)\n\t\t\tcount = 0\n\tmini = max(count + 1, mini)\n\tprint(mini)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nwhile t:\n\tt -= 1\n\tmoves = 'R' + str(input().strip()) + 'R'\n\t(prev, ans) = (0, 0)\n\tfor (idx, char) in enumerate(moves):\n\t\tif char == 'R':\n\t\t\tans = max(ans, idx - prev)\n\t\t\tprev = idx\n\tprint(ans)\n", "from sys import stdin, stdout\nimport math, sys, heapq\nfrom itertools import permutations, combinations\nfrom collections import defaultdict, deque, OrderedDict\nfrom os import path\nimport random\nimport bisect as bi\n\ndef yes():\n\tprint('YES')\n\ndef no():\n\tprint('NO')\nif path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\n\tdef I():\n\t\treturn int(input())\n\n\tdef In():\n\t\treturn map(int, input().split())\nelse:\n\n\tdef I():\n\t\treturn int(stdin.readline())\n\n\tdef In():\n\t\treturn map(int, stdin.readline().split())\nsys.setrecursionlimit(10000)\n\ndef dict(a):\n\td = {}\n\tfor x in a:\n\t\tif d.get(x, -1) != -1:\n\t\t\td[x] += 1\n\t\telse:\n\t\t\td[x] = 1\n\treturn d\n\ndef find_gt(a, x):\n\ti = bi.bisect_right(a, x)\n\tif i != len(a):\n\t\treturn i\n\telse:\n\t\treturn -1\n\ndef main():\n\ttry:\n\t\tl = ['R'] + list(input()) + ['R']\n\t\tn = len(l)\n\t\tcount = 0\n\t\tans = 0\n\t\tfor x in range(n):\n\t\t\tif l[x] == 'R':\n\t\t\t\tans = max(count + 1, ans)\n\t\t\t\tcount = 0\n\t\t\telse:\n\t\t\t\tcount += 1\n\t\tprint(ans)\n\texcept:\n\t\tpass\nM = 998244353\nP = 1000000007\nMa = 100000000000\nfor _ in range(I()):\n\tmain()\n", "for _ in range(int(input())):\n\tarr = list(input())\n\tcount = 0\n\tans = 0\n\tfor k in range(len(arr)):\n\t\tif arr[k] == 'L':\n\t\t\tcount += 1\n\t\t\tans = max(ans, count)\n\t\telse:\n\t\t\tcount = 0\n\tprint(ans + 1)\n", "n = int(input())\nfor x in range(n):\n\tt = input()\n\tl = -1\n\tmaxs = 0\n\tfor xy in range(len(t)):\n\t\tif t[xy] == 'R':\n\t\t\tmaxs = max(xy - l, maxs)\n\t\t\tl = xy\n\tmaxs = max(len(t) - l, maxs)\n\tprint(maxs)\n", "n = int(input())\nfor i in range(n):\n\tst = input()\n\tpos = [0]\n\tfor j in range(len(st)):\n\t\tif st[j] == 'R':\n\t\t\tpos.append(j + 1)\n\tpos.append(len(st) + 1)\n\ttemp = 0\n\tfor j in range(1, len(pos)):\n\t\ttemp = max(temp, pos[j] - pos[j - 1])\n\tprint(temp)\n", "def main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\ts = input()\n\t\tpos = [0]\n\t\tfor (i, ch) in enumerate(s):\n\t\t\tif ch == 'R':\n\t\t\t\tpos.append(i + 1)\n\t\tpos.append(len(s) + 1)\n\t\td = 0\n\t\tfor i in range(len(pos) - 1, 0, -1):\n\t\t\td = max(d, pos[i] - pos[i - 1])\n\t\tprint(d)\nmain()\n", "T = int(input())\nfor x in range(T):\n\tstring = ['R']\n\ty = input()\n\ts = 1\n\tfor z in y:\n\t\tstring.append(z)\n\t\ts = s + 1\n\tstring.append('R')\n\ts = s + 1\n\ttemp = 0\n\tdiff = 0\n\tfor a in range(1, s):\n\t\tif string[a] == 'R':\n\t\t\tif a - diff > temp:\n\t\t\t\ttemp = a - diff\n\t\t\t\tdiff = a\n\t\t\telse:\n\t\t\t\tdiff = a\n\tprint(temp)\n", "from bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nimport heapq\nimport math\nfrom collections import *\nfrom functools import reduce, cmp_to_key\nimport sys\ninput = sys.stdin.readline\nM = mod = 10 ** 9 + 7\n\ndef factors(n):\n\treturn sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))\n\ndef inv_mod(n):\n\treturn pow(n, mod - 2, mod)\n\ndef li():\n\treturn [int(i) for i in input().rstrip('\\n').split()]\n\ndef st():\n\treturn input().rstrip('\\n')\n\ndef val():\n\treturn int(input().rstrip('\\n'))\n\ndef li2():\n\treturn [i for i in input().rstrip('\\n')]\n\ndef li3():\n\treturn [int(i) for i in input().rstrip('\\n')]\nfor _ in range(val()):\n\ts = st()\n\tn = len(s)\n\tl = [0 for i in range(n + 2)]\n\td = -1\n\tlast = n + 1\n\tfor i in range(len(s), 0, -1):\n\t\tif s[i - 1] == 'R':\n\t\t\tl[i] = last - i\n\t\t\tlast = i\n\t\t\td = max(d, l[i])\n\td = max(d, last - 0)\n\tprint(d if d > 0 else n + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tloc_count = 0\n\tglo_count = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tloc_count += 1\n\t\telse:\n\t\t\tloc_count = 0\n\t\tglo_count = max(loc_count, glo_count)\n\tprint(glo_count + 1)\n", "for i in [*open(0)][1:]:\n\tprint(max(map(len, i.replace('\\n', '').split('R'))) + 1)\n", "t = int(input())\nwhile t:\n\ts = input()\n\tl = 0\n\tml = 0\n\tfor i in range(len(s)):\n\t\tml = max(l, ml)\n\t\tif s[i] == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tl = 0\n\t\tml = max(l, ml)\n\tprint(ml + 1)\n\tt -= 1\n", "t = int(input())\nfor i in range(t):\n\tst = input()\n\tans = 0\n\tmaans = 0\n\tfor j in range(len(st)):\n\t\tif st[j] == 'L':\n\t\t\tans += 1\n\t\telse:\n\t\t\tans = 0\n\t\tmaans = max(ans, maans)\n\tprint(maans + 1)\n", "from sys import stdin, stdout\n(_input, _print) = (stdin.readline, stdout.write)\n(_range, _int, _list, _len, _str) = (range, int, list, len, str)\n\ndef solution():\n\tfor _ in _range(_int(_input())):\n\t\ts = _input().replace('\\n', '').rstrip('R').lstrip('R')\n\t\tn = _len(s)\n\t\tif n != 0:\n\t\t\tarr = [0] * n\n\t\t\tarr[0] = 1\n\t\t\tfor i in _range(1, n):\n\t\t\t\tif s[i] == 'L' and s[i - 1] == 'L':\n\t\t\t\t\tarr[i] = arr[i - 1] + 1\n\t\t\t\telif s[i] == 'L' and s[i - 1] != 'L':\n\t\t\t\t\tarr[i] = 1\n\t\t\t\telse:\n\t\t\t\t\tarr[i] = 0\n\t\t\tprint(max(arr) + 1)\n\t\telse:\n\t\t\tprint(1)\nsolution()\n", "from sys import stdin, stdout\nn = int(stdin.readline())\nfor i in range(n):\n\tlst = stdin.readline()\n\tk = 0\n\tans = 0\n\tfor j in lst:\n\t\tif j == 'L':\n\t\t\tk += 1\n\t\tif j == 'R':\n\t\t\tans = max(ans, k + 1)\n\t\t\tk = 0\n\tans = max(ans, k + 1)\n\tstdout.write(str(ans) + '\\n')\n", "for _ in range(int(input())):\n\tstring = str(input())\n\ttamanho_das_sequencias_L = []\n\tfor sequencia in string.split('R'):\n\t\tif sequencia:\n\t\t\ttamanho_das_sequencias_L.append(len(sequencia))\n\tif tamanho_das_sequencias_L:\n\t\ttamanho_das_sequencias_L.sort()\n\t\tprint(tamanho_das_sequencias_L[-1] + 1)\n\telse:\n\t\tprint(1)\n", "t = int(input())\nfor _ in range(t):\n\tk = [len(x) for x in input().split('R')]\n\tprint(max(k) + 1)\n", "def calcJumps(seq):\n\tjumps = 1\n\tmaxLength = 0\n\tlength = 0\n\tfor i in range(len(seq)):\n\t\tif seq[i] == 'L':\n\t\t\tlength += 1\n\t\telse:\n\t\t\tif length > maxLength:\n\t\t\t\tmaxLength = length\n\t\t\tlength = 0\n\tif length > maxLength:\n\t\tmaxLength = length\n\tif maxLength > 0:\n\t\tjumps = maxLength + 1\n\treturn jumps\nt = int(input())\nresults = []\nfor i in range(t):\n\tseq = input()\n\tresults.append(calcJumps(seq))\nfor i in range(t):\n\tprint(results[i])\n", "import math\nt = int(input())\nans = []\nfor i in range(t):\n\tk = 0\n\td = 1\n\ts = str(input())\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tk += 1\n\t\telif k != 0:\n\t\t\td = max(k + 1, d)\n\t\t\tk = 0\n\tif k != 0:\n\t\td = max(k + 1, d)\n\tans.append(d)\nfor i in range(len(ans)):\n\tprint(ans[i])\n", "for _ in range(int(input())):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tprev = 0\n\tl = len(s)\n\tmaxx = 0\n\tfor i in range(1, l):\n\t\tif s[i] == 'R':\n\t\t\tmaxx = max(maxx, i - prev)\n\t\t\tprev = i\n\tprint(maxx)\n", "t = int(input().strip())\nfor _ in range(t):\n\ts = input().strip()\n\ts += 'R'\n\tcounter = 0\n\tans = 0\n\tfor i in range(len(s)):\n\t\tcounter += 1\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, counter)\n\t\t\tcounter = 0\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tmc = 0\n\tcount = 0\n\tfor char in s:\n\t\tif char == 'R':\n\t\t\tcount = 0\n\t\telif char == 'L':\n\t\t\tcount += 1\n\t\tmc = max(mc, count)\n\tprint(mc + 1)\n", "import sys\nimport math\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tmaxi = 0\n\tn = len(s)\n\tj = 0\n\tfor i in range(n):\n\t\tmaxi += 1\n\t\tif s[i] == 'R':\n\t\t\tj = i\n\t\t\tbreak\n\tdiff = 0\n\tl_index = j\n\tfor i in range(j + 1, n):\n\t\tdiff += 1\n\t\tif s[i] == 'R':\n\t\t\tif diff > maxi:\n\t\t\t\tmaxi = diff\n\t\t\tdiff = 0\n\t\t\tl_index = i\n\tn -= 1\n\tif n - l_index > maxi:\n\t\tmaxi = n - l_index\n\tprint(maxi)\n", "def jump(s):\n\tcontl = 0\n\td = 0\n\tfor e in range(len(s)):\n\t\tif s[e] == 'L':\n\t\t\tcontl += 1\n\t\telse:\n\t\t\tif contl > d:\n\t\t\t\td = contl\n\t\t\tcontl = 0\n\tif contl > d:\n\t\td = contl\n\treturn d + 1\nt = int(input())\nfor a in range(t):\n\ts = input()\n\tprint(jump(s))\n", "t = int(input())\nfor i in range(t):\n\ts = list(input().split())\n\tl1 = []\n\tfor j in range(len(s[0])):\n\t\tif s[0][j] == 'R':\n\t\t\tl1.append(j)\n\tif len(l1) >= 1:\n\t\tx = abs(l1[0] + 1)\n\t\tfor j in range(len(l1) - 1):\n\t\t\tx = max(x, abs(l1[j] - l1[j + 1]))\n\t\tx = max(x, abs(l1[len(l1) - 1] - len(s[0])))\n\t\tprint(x)\n\telse:\n\t\tprint(len(s[0]) + 1)\n", "for i in range(int(input())):\n\ts = input()\n\ts = '#' + s + '#'\n\tn = len(s)\n\tmx = -87654333334\n\tr = n - 1\n\tstep = 0\n\tfor i in range(n - 2, -1, -1):\n\t\tif s[i] == 'R' or s[i] == '#':\n\t\t\tif step <= 0:\n\t\t\t\tmx = r - i\n\t\t\t\tstep = mx\n\t\t\telse:\n\t\t\t\tstep = mx\n\t\t\tr = i\n\t\telse:\n\t\t\tstep -= 1\n\tprint(mx)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tres = [0]\n\tindices = [0]\n\tfor (i, c) in enumerate(s):\n\t\tif c == 'R':\n\t\t\tres.append(i + 1 - indices[-1])\n\t\t\tindices.append(i + 1)\n\tres.append(len(s) + 1 - indices[-1])\n\tprint(max(res))\n", "n = int(input())\n\ndef ls(lista):\n\taux = []\n\tparte = ''\n\tfor i in range(len(lista)):\n\t\tif lista[i] != 'R':\n\t\t\tparte += lista[i]\n\t\telif parte != '':\n\t\t\taux.append(parte)\n\t\t\tparte = ''\n\tif parte != '':\n\t\taux.append(parte)\n\taux.sort(reverse=True)\n\treturn aux\nfor i in range(n):\n\tcaso = list(input())\n\taux = ls(caso)\n\tresposta = 0\n\tif len(aux) > 0:\n\t\tresposta = len(aux[0])\n\tprint(resposta + 1)\n", "for _ in range(int(input())):\n\tL = [*map(str, input().split('R'))]\n\tprint(max((len(i) for i in L)) + 1)\n", "for i in range(int(input())):\n\ts = input()\n\tl = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\tans = float('-inf')\n\tfor i in range(1, len(l)):\n\t\tans = max(ans, l[i] - l[i - 1])\n\tprint(ans)\n", "t = int(input())\nfor T in range(t):\n\ts = input()\n\tl = list(s.split('R'))\n\tans = len(l[0])\n\tfor i in l:\n\t\tans = max(ans, len(i))\n\tprint(ans + 1)\n", "def sol():\n\tT = int(input())\n\tfor i in range(T):\n\t\tbridge = input()\n\t\tbridge += 'R'\n\t\tprev_r = -1\n\t\tmax_interval = 0\n\t\tfor i in range(len(bridge)):\n\t\t\tif bridge[i] == 'R':\n\t\t\t\tinterval = i - prev_r\n\t\t\t\tprev_r = i\n\t\t\t\tmax_interval = max(max_interval, interval)\n\t\tprint(max_interval)\nsol()\n", "for i in range(int(input())):\n\ta = input()\n\tn = len(a)\n\tans = 1\n\tk = -1\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tans = max(ans, i - k)\n\t\t\tk = i\n\tif k != n - 1:\n\t\tans = max(n - k, ans)\n\tprint(ans)\n", "from sys import stdin\n\ndef solve(t):\n\t(idxs, n, ans) = ([0], len(t), float('-inf'))\n\tfor i in range(n):\n\t\tif t[i] == 'R':\n\t\t\tidxs.append(i + 1)\n\tidxs.append(n + 1)\n\tfor i in range(len(idxs) - 1):\n\t\tans = max(ans, idxs[i + 1] - idxs[i])\n\treturn ans\n\ndef main():\n\tr = stdin.readline\n\tcases = int(r())\n\tfor case in range(cases):\n\t\tt = r().strip()\n\t\tprint(solve(t))\nmain()\n", "def possible(s):\n\tmax_ = 0\n\tval = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmax_ = max(max_, i - val)\n\t\t\tval = i\n\tmax_ = max(max_, len(s) - val)\n\treturn max_\nfor _ in range(int(input())):\n\ts = input()\n\tprint(possible(s))\n", "from sys import stdin\nt = int(input())\nfor _ in range(t):\n\tstring = stdin.readline().strip()\n\tmaxdist = 1\n\tprev = -1\n\tfor (i, char) in enumerate(string):\n\t\tif char == 'R':\n\t\t\tmaxdist = max(maxdist, i - prev)\n\t\t\tprev = i\n\tmaxdist = max(maxdist, len(string) - prev)\n\tprint(maxdist)\n", "def ok(s, x, n):\n\ti = -1\n\twhile i < n:\n\t\tif i + x >= n:\n\t\t\treturn 1\n\t\tb = 0\n\t\tfor j in range(1, x + 1):\n\t\t\tif s[i + j] == 'R':\n\t\t\t\ti += j\n\t\t\t\tb = 1\n\t\t\t\tbreak\n\t\tif b == 0:\n\t\t\treturn 0\n\ndef solve():\n\ts = input().strip()\n\tn = len(s)\n\tlb = 1\n\trb = n + 1\n\twhile lb < rb:\n\t\tmb = (lb + rb) // 2\n\t\tif ok(s, mb, n):\n\t\t\trb = mb\n\t\telse:\n\t\t\tlb = mb + 1\n\tprint(lb)\nt = int(input())\nwhile t:\n\tt -= 1\n\tsolve()\n", "t = int(input())\nfor k in range(t):\n\tst = input()\n\tn = len(st)\n\tprev_ind = n\n\td = 0\n\tfor i in range(1, n + 1):\n\t\tif st[n - i] == 'R':\n\t\t\tcur_d = prev_ind - (n - i)\n\t\t\tprev_ind = n - i\n\t\t\tif cur_d > d:\n\t\t\t\td = cur_d\n\tcur_d = prev_ind - -1\n\tif cur_d > d:\n\t\td = cur_d\n\tif d == 0:\n\t\td = n + 1\n\tprint(d)\n", "from sys import stdin\nfor _ in range(int(stdin.readline())):\n\ts = stdin.readline().strip()\n\ts = 'R' + s + 'R'\n\tm = 0\n\tpre = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max(i - pre, m)\n\t\t\tpre = i\n\tprint(m)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tl = []\n\tn = len(s)\n\tl.append(0)\n\tc = 2\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\t\t\tc += 1\n\tl.append(n + 1)\n\tmax = 0\n\tfor i in range(c - 1):\n\t\tf = l[i + 1] - l[i]\n\t\tif f > max:\n\t\t\tmax = f\n\tprint(max)\n", "t = int(input())\nd = []\nfor i in range(0, t):\n\tb1 = input().split()\n\tb = list(b1[0])\n\tmax = 1\n\ti = 0\n\tj = 0\n\twhile j < len(b):\n\t\tif b[i] == b[j]:\n\t\t\tj += 1\n\t\telse:\n\t\t\tif max < j - i + 1 and b[i] == 'L':\n\t\t\t\tmax = j - i + 1\n\t\t\ti = j\n\t\t\tj = i + 1\n\tif max < j - i + 1 and b[i] == 'L':\n\t\tmax = j - i + 1\n\td.append(max)\nfor i in d:\n\tprint(i)\n", "for _ in range(int(input())):\n\ts = input()\n\tt = len(s)\n\tm = 1\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tm = max(m, t - i)\n\t\t\tt = i\n\tprint(max(m, t + 1))\n", "for _ in range(int(input())):\n\ts = input()\n\n\tdef maxRepeating(str):\n\t\tn = len(str)\n\t\tcur_count = 1\n\t\td = {}\n\t\tfor ele in set(list(str)):\n\t\t\td[ele] = 0\n\t\tfor i in range(n):\n\t\t\tif i < n - 1 and str[i] == str[i + 1]:\n\t\t\t\tcur_count += 1\n\t\t\telse:\n\t\t\t\tif cur_count > d[str[i]]:\n\t\t\t\t\td[str[i]] = cur_count\n\t\t\t\tcur_count = 1\n\t\treturn d\n\ta = maxRepeating(s)\n\tif 'L' in a:\n\t\tprint(a['L'] + 1)\n\telse:\n\t\tprint(1)\n", "t = int(input())\nfor iii in range(t):\n\ts = input()\n\tmx = 0\n\tk = 0\n\tfor i in range(len(s)):\n\t\tk += 1\n\t\tif s[i] == 'R':\n\t\t\tmx = max(mx, k)\n\t\t\tk = 0\n\tk += 1\n\tmx = max(mx, k)\n\tprint(mx)\n", "I = lambda : map(int, input().split())\nfor _ in range(int(input())):\n\tn = input()\n\tc = 0\n\tk = d = 0\n\tl = [0]\n\tfor i in range(len(n)):\n\t\tif n[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(i + 2)\n\tfor i in range(1, len(l)):\n\t\td = max(d, l[i] - l[i - 1])\n\tprint(d)\n", "n = int(input())\nfor _ in range(n):\n\ts = list(input())\n\ts2 = [-1] + [i for i in range(len(s)) if s[i] == 'R'] + [len(s)]\n\tans = 0\n\tfor i in range(len(s2) - 1):\n\t\tans = max(ans, s2[i + 1] - s2[i])\n\tprint(ans)\n", "t = int(input())\nfor j in range(t):\n\ts = input()\n\ta = list(s)\n\tb = []\n\tind = -1\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tb.append(i - ind)\n\t\t\tind = i\n\tb.append(len(a) - ind)\n\tb.sort()\n\tprint(b[len(b) - 1])\n", "for _ in range(int(input())):\n\ts = input()\n\ts = 'R' + s + 'R'\n\ti = 0\n\tj = 1\n\tmaxx = 0\n\twhile j < len(s):\n\t\twhile s[j] == 'L':\n\t\t\tj += 1\n\t\tmaxx = max(maxx, j - i)\n\t\ti = j\n\t\tj = i + 1\n\tprint(maxx)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tma = 0\n\tc = 0\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\t\tma = max(ma, c)\n\tprint(ma + 1)\n", "import sys\nn = int(sys.stdin.readline())\nfor _ in range(n):\n\ts = sys.stdin.readline().strip()\n\tmx = 0\n\ttemp = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\ttemp += 1\n\t\t\tmx = max(mx, temp)\n\t\telse:\n\t\t\ttemp = 0\n\tprint(mx + 1)\n", "def main():\n\ta = str(input())\n\tn = len(a)\n\tcnt = 0\n\ti = 0\n\tindex = 0\n\twhile i < n:\n\t\tindex = i\n\t\twhile index < n and a[index] == 'L':\n\t\t\tindex += 1\n\t\tcnt = max(index - i + 1, cnt)\n\t\ti = index + 1\n\tprint(cnt)\n\treturn\n\ndef test():\n\tt = int(input())\n\twhile t:\n\t\tmain()\n\t\tt -= 1\ntest()\n", "t = int(input())\nans = []\nfor i in range(t):\n\ts = str(input())\n\tmxl = 0\n\tcnt = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tcnt += 1\n\t\t\tmxl = max(cnt, mxl)\n\t\telse:\n\t\t\tcnt = 0\n\tans.append(mxl + 1)\nfor k in range(t):\n\tprint(ans[k])\n", "for _ in range(int(input())):\n\tlst = map(len, input().split('R'))\n\tprint(max(lst) + 1)\n", "from collections import Counter\nfrom collections import defaultdict\nimport math\nt = int(input())\nfor _ in range(0, t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tk = 0\n\tdiff = 0\n\tn = len(s)\n\tfor i in range(1, n):\n\t\tif s[i] == 'R':\n\t\t\tans = i - k\n\t\t\tdiff = max(diff, ans)\n\t\t\tk = i\n\tprint(diff)\n", "import collections\nimport sys\ninput = sys.stdin.readline\nL = ''\n\ndef f(d):\n\ti = 0\n\tn = len(L)\n\twhile True:\n\t\tfor j in range(d, 0, -1):\n\t\t\tif i + j >= n + 1:\n\t\t\t\treturn True\n\t\t\tif L[i + j - 1] == 'R':\n\t\t\t\ti = i + j\n\t\t\t\tbreak\n\t\telse:\n\t\t\tbreak\n\treturn False\nfor _ in range(int(input())):\n\tL = input().strip()\n\t(s, e) = (0, len(L) + 2)\n\twhile e - s > 1:\n\t\tm = (s + e) // 2\n\t\tif f(m):\n\t\t\te = m\n\t\telse:\n\t\t\ts = m\n\tprint(e)\n", "def funcao(chute, ps, n):\n\ti = ps\n\twhile i < len(lista) - 1:\n\t\tif chute + i >= n + 1:\n\t\t\treturn True\n\t\tj = i\n\t\twhile j < i + chute:\n\t\t\tj += 1\n\t\t\tif j >= len(lista):\n\t\t\t\treturn True\n\t\t\telif lista[j] == 'R':\n\t\t\t\ti = j\n\t\treturn False\nt = int(input())\nres = []\nk = 0\nwhile k < t:\n\tlista = list(input())\n\tn = len(lista)\n\tmenor = n + 1\n\tl = 1\n\tr = n + 1\n\twhile l <= r:\n\t\tmed = int((l + r) / 2)\n\t\tif funcao(med, -1, n):\n\t\t\tmenor = min(menor, med)\n\t\t\tr = med - 1\n\t\telse:\n\t\t\tl = med + 1\n\tres.append(menor)\n\tk += 1\nfor e in res:\n\tprint(e)\n", "for i in range(int(input())):\n\ta = list(input())\n\tif 'R' not in a:\n\t\tprint(len(a) + 1)\n\telif 'L' not in a:\n\t\tprint(1)\n\telse:\n\t\tt = []\n\t\tf = -1\n\t\tfor k in range(len(a)):\n\t\t\tif a[k] == 'R':\n\t\t\t\tt.append(k - f)\n\t\t\t\tf = k\n\t\tt.append(a[::-1].index('R') + 1)\n\t\tprint(max(t))\n", "def solve():\n\tstring = input()\n\tminimum = 0\n\tskip = string.split('R')\n\tfor s in skip:\n\t\tif len(s) + 1 > minimum:\n\t\t\tminimum = len(s) + 1\n\tprint(minimum)\nfor _ in range(int(input())):\n\tsolve()\n", "t = int(input())\nfor i in range(t):\n\ta = list(input())\n\tcntMax = 0\n\tcntTmp = 0\n\tfor i in range(len(a)):\n\t\tif a[i] == 'L':\n\t\t\tcntTmp += 1\n\t\telif cntTmp != 0:\n\t\t\tcntMax = max(cntMax, cntTmp)\n\t\t\tcntTmp = 0\n\t\tcntMax = max(cntMax, cntTmp)\n\tprint(cntMax + 1)\n", "t = int(input())\nfor c in range(t):\n\tmoves = input()\n\tl = [0]\n\tlength = len(moves)\n\tfor i in range(length):\n\t\tif moves[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(length + 1)\n\tjumps = []\n\tfor i in range(1, len(l)):\n\t\tjumps.append(l[i] - l[i - 1])\n\tprint(max(jumps))\n", "t = int(input())\nflag = 0\nres = -1\ncount = 1\nfor i in range(t):\n\ta = list(map(str, input()))\n\tfor j in range(len(a)):\n\t\tif a[j] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tres = max(res, count)\n\t\t\tcount = 1\n\tres = max(res, count)\n\tcount = 1\n\tprint(res)\n\tres = -1\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tmx = 0\n\tlst = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmx = max(mx, i - lst)\n\t\t\tlst = i\n\tprint(mx)\n", "testes = int(input())\nfor c in range(testes):\n\tstring = input()\n\tw = 1\n\taws = 0\n\tfor v in range(len(string)):\n\t\tif string[v] == 'L':\n\t\t\tw += 1\n\t\telse:\n\t\t\taws = max(aws, w)\n\t\t\tw = 1\n\taws = max(aws, w)\n\tprint(aws)\n", "for _ in range(int(input())):\n\ts = input().split('R')\n\td = 0\n\tfor i in s:\n\t\td = max(len(i), d)\n\tprint(d + 1)\n", "from collections import defaultdict\n\ndef solve(s):\n\tmp = defaultdict(list)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmp[s[i]].append(i + 1)\n\tif len(mp['R']) == 0:\n\t\treturn len(s) + 1\n\tl = [0] + list(mp['R']) + [len(s) + 1]\n\tans = -1\n\tfor i in range(len(l) - 1, 0, -1):\n\t\tif l[i] - l[i - 1] > ans:\n\t\t\tans = l[i] - l[i - 1]\n\treturn ans\nt = int(input())\nwhile t:\n\ts = input()\n\tprint(solve(s))\n\tt -= 1\n", "t = int(input())\nwhile t:\n\ts = input()\n\tl = [0]\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tm = 0\n\tl.append(len(s) + 1)\n\tfor i in range(0, len(l) - 1):\n\t\tm = max(m, l[i + 1] - l[i])\n\tprint(m)\n\tt -= 1\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\ts += 'R'\n\tlast_r = 0\n\tdiff = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\ttemp = j - last_r + 1\n\t\t\tdiff = max(diff, temp)\n\t\t\tlast_r = j + 1\n\tprint(diff)\n", "import sys\ninput = sys.stdin.readline\nread = lambda : map(int, input().split())\nread_float = lambda : map(float, input().split())\n\ndef ceil(x):\n\tif x != int(x):\n\t\tx = int(x) + 1\n\treturn x\n\ndef factorial(x, m):\n\tval = 1\n\twhile x > 0:\n\t\tval = val * x % m\n\t\tx -= 1\n\treturn val\n\ndef fact(x):\n\tval = 1\n\twhile x > 0:\n\t\tval *= x\n\t\tx -= 1\n\treturn val\n\ndef swaparr(arr, a, b):\n\ttemp = arr[a]\n\tarr[a] = arr[b]\n\tarr[b] = temp\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a % b)\n\ndef lcm(a, b):\n\treturn a * b // math.gcd(a, b)\n\ndef nCr(n, k):\n\tif k > n:\n\t\treturn 0\n\tif k > n - k:\n\t\tk = n - k\n\tres = 1\n\tfor i in range(k):\n\t\tres = res * (n - i)\n\t\tres = res / (i + 1)\n\treturn int(res)\n\ndef primefs(n):\n\tprimes = {}\n\twhile n % 2 == 0 and n > 0:\n\t\tprimes[2] = primes.get(2, 0) + 1\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 2, 2):\n\t\twhile n % i == 0 and n > 0:\n\t\t\tprimes[i] = primes.get(i, 0) + 1\n\t\t\tn = n // i\n\tif n > 2:\n\t\tprimes[n] = primes.get(n, 0) + 1\n\treturn primes\n\ndef power(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef swap(a, b):\n\ttemp = a\n\ta = b\n\tb = temp\n\treturn (a, b)\n\ndef find(x, link):\n\tp = x\n\twhile p != link[p]:\n\t\tp = link[p]\n\twhile x != p:\n\t\tnex = link[x]\n\t\tlink[x] = p\n\t\tx = nex\n\treturn p\n\ndef union(x, y, link, size):\n\tx = find(x, link)\n\ty = find(y, link)\n\tif size[x] < size[y]:\n\t\t(x, y) = swap(x, y)\n\tif x != y:\n\t\tsize[x] += size[y]\n\t\tlink[y] = x\n\ndef sieve(n):\n\tprime = [True for i in range(n + 1)]\n\t(prime[0], prime[1]) = (False, False)\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\treturn prime\n\ndef phi(n):\n\tresult = n\n\tp = 2\n\twhile p * p <= n:\n\t\tif n % p == 0:\n\t\t\twhile n % p == 0:\n\t\t\t\tn = n // p\n\t\t\tresult = result * (1.0 - 1.0 / float(p))\n\t\tp = p + 1\n\tif n > 1:\n\t\tresult = result * (1.0 - 1.0 / float(n))\n\treturn int(result)\n\ndef is_prime(n):\n\tif n == 0:\n\t\treturn False\n\tif n == 1:\n\t\treturn True\n\tfor i in range(2, int(n ** (1 / 2)) + 1):\n\t\tif not n % i:\n\t\t\treturn False\n\treturn True\nMAXN = int(100000.0 + 5)\n\ndef spf_sieve():\n\tspf[1] = 1\n\tfor i in range(2, MAXN):\n\t\tspf[i] = i\n\tfor i in range(4, MAXN, 2):\n\t\tspf[i] = 2\n\tfor i in range(3, ceil(MAXN ** 0.5), 2):\n\t\tif spf[i] == i:\n\t\t\tfor j in range(i * i, MAXN, i):\n\t\t\t\tif spf[j] == j:\n\t\t\t\t\tspf[j] = i\nspf = [0 for i in range(MAXN)]\n\ndef factoriazation(x):\n\tres = []\n\tfor i in range(2, int(x ** 0.5) + 1):\n\t\twhile x % i == 0:\n\t\t\tres.append(i)\n\t\t\tx //= i\n\tif x != 1:\n\t\tres.append(x)\n\treturn res\n\ndef factors(n):\n\tres = []\n\tfor i in range(1, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\tres.append(i)\n\t\t\tres.append(n // i)\n\treturn list(set(res))\n\ndef int_array():\n\treturn list(map(int, input().strip().split()))\n\ndef float_array():\n\treturn list(map(float, input().strip().split()))\n\ndef str_array():\n\treturn input().strip().split()\n\ndef binary_search(low, high, w, h, n):\n\twhile low < high:\n\t\tmid = low + (high - low) // 2\n\t\tif check(mid, w, h, n):\n\t\t\tlow = mid + 1\n\t\telse:\n\t\t\thigh = mid\n\treturn low\n\ndef check(councils, a, k):\n\tsumm = 0\n\tfor x in a:\n\t\tsumm += min(x, councils)\n\treturn summ // councils >= k\nMOD = int(1000000000.0) + 7\nCMOD = 998244353\nINF = float('inf')\nNINF = -float('inf')\nfrom itertools import permutations\nimport math\nimport bisect as bis\nimport random\nimport sys\n\ndef solve():\n\ts = input().rstrip()\n\tc = 0\n\tm = 0\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tm = max(c, m)\n\t\t\tc = 0\n\tm = max(c, m)\n\tprint(m + 1)\nfor _ in range(int(input())):\n\tsolve()\n", "def solve():\n\ts = input()\n\tmp = 0\n\tp = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tp += 1\n\t\telse:\n\t\t\tmp = max(mp, p)\n\t\t\tp = 0\n\tmp = max(mp, p)\n\tprint(mp + 1)\nfor i in range(int(input())):\n\tsolve()\n", "T = int(input())\nn = [0] * T\nk = [0] * T\nns = [0] * T\nfor t in range(T):\n\tk[t] = list(input())\nfor t in range(T):\n\tml = 0\n\tcl = 0\n\tfor i in k[t]:\n\t\tif i == 'L':\n\t\t\tcl += 1\n\t\telse:\n\t\t\tml = max(cl, ml)\n\t\t\tcl = 0\n\tml = max(cl, ml)\n\tprint(ml + 1)\n", "def frog(arr):\n\tmax_n = 0\n\tcounts = 0\n\tfor i in range(len(arr)):\n\t\tif arr[i] == 'L':\n\t\t\tcounts += 1\n\t\telse:\n\t\t\tmax_n = max(counts, max_n)\n\t\t\tcounts = 0\n\tmax_n = max(counts, max_n)\n\treturn max_n + 1\nt = int(input())\nfor i in range(1, t + 1):\n\tarr = input()\n\tans = frog(arr)\n\tprint(ans)\n", "n = int(input())\nfor i in range(n):\n\tjumpStr = input().strip()\n\tanswer = -1\n\tprev = -1\n\tfor j in range(len(jumpStr)):\n\t\tif jumpStr[j] == 'R':\n\t\t\tanswer = max(answer, j - prev)\n\t\t\tprev = j\n\tif prev == -1:\n\t\tanswer = len(jumpStr) - prev\n\telse:\n\t\tanswer = max(len(jumpStr) - prev, answer)\n\tprint(answer)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = s.split('R')\n\tma = 0\n\tfor i in a:\n\t\tma = max(ma, len(i))\n\tprint(ma + 1)\n", "from collections import deque\nimport sys\nsys.setrecursionlimit(5000)\nt = int(input().rstrip())\nfor _ in range(t):\n\tarr = [ch for ch in input().rstrip()]\n\tjump = [0]\n\ti = 0\n\twhile i < len(arr):\n\t\tif arr[i] == 'R':\n\t\t\tjump.append(i + 1)\n\t\ti = i + 1\n\tjump.append(len(arr) + 1)\n\tans = 0\n\tfor i in range(len(jump) - 1):\n\t\tif jump[i + 1] - jump[i] > ans:\n\t\t\tans = jump[i + 1] - jump[i]\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tmax_l = 0\n\tl = 0\n\tflg_s = False\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\tif flg_s:\n\t\t\t\tl += 1\n\t\t\telse:\n\t\t\t\tflg_s = True\n\t\t\t\tl = 1\n\t\telif flg_s:\n\t\t\tflg_s = False\n\t\t\tif l > max_l:\n\t\t\t\tmax_l = l\n\tif l > max_l:\n\t\tmax_l = l\n\tprint(max_l + 1)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tS = input().strip()\n\t\tma = 1\n\t\ttmp = 0\n\t\tfor s in S:\n\t\t\tif s == 'R':\n\t\t\t\tma = max(ma, tmp + 1)\n\t\t\t\ttmp = 0\n\t\t\telse:\n\t\t\t\ttmp += 1\n\t\tma = max(ma, tmp + 1)\n\t\tprint(ma)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tb = [-1] + [x for x in range(len(s)) if s[x] == 'R'] + [len(s)]\n\tif len(b) == 1:\n\t\tprint(2)\n\telse:\n\t\tprint(max([b[y] - b[y - 1] for y in range(1, len(b))]))\n", "T = int(input())\nwhile T:\n\ts = input()\n\tpos = []\n\tpos.append(0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(len(s) + 1)\n\tans = 0\n\tfor i in range(len(pos) - 1):\n\t\tans = max(ans, pos[i + 1] - pos[i])\n\tprint(ans)\n\tT -= 1\n", "def frog(s):\n\tcount = 0\n\tmaxi = 0\n\tcountl = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'L' and s[i - 1] == s[i]:\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 0\n\t\tmaxi = max(maxi, count)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcountl += 1\n\tif maxi == 0:\n\t\tif countl > 0:\n\t\t\treturn 2\n\t\telse:\n\t\t\treturn 1\n\telse:\n\t\treturn maxi + 2\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tprint(frog(s))\n", "from sys import stdin, stdout\nfrom collections import Counter\nfrom itertools import permutations\nimport bisect\nimport math\nI = lambda : map(int, stdin.readline().split())\nI1 = lambda : stdin.readline()\nfor _ in range(int(I1())):\n\ts = I1().strip()\n\tl = [0]\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(n + 1)\n\tm = 0\n\tfor i in range(1, len(l)):\n\t\tm = max(m, l[i] - l[i - 1])\n\tprint(m)\n", "from sys import stdin\nfrom collections import deque\nmod = 10 ** 9 + 7\nimport sys\nfrom queue import PriorityQueue\nfrom bisect import bisect_right\nfrom bisect import bisect_left\nfrom collections import defaultdict\nfrom math import sqrt, factorial, gcd, log2, inf, ceil\nimport heapq\ninput = lambda : sys.stdin.readline().rstrip()\nfrom sys import stdin, stdout\nfrom heapq import heapify, heappush, heappop\nfrom itertools import permutations\nfrom math import factorial as f\n\ndef ncr(x, y):\n\treturn f(x) // (f(y) * f(x - y))\nt = int(input())\nfor _ in range(t):\n\ts = list(input())\n\ts = ['0'] + s + ['0']\n\tmaxi = 0\n\tposn = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == '0' or s[i] == 'R':\n\t\t\tmaxi = max(i - posn, maxi)\n\t\t\tposn = i\n\tprint(maxi)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tc = 0\n\tmx = 0\n\tfor j in s:\n\t\tif j == 'L':\n\t\t\tc = c + 1\n\t\telse:\n\t\t\tmx = max(c, mx)\n\t\t\tc = 0\n\tmx = max(mx, c)\n\tprint(mx + 1)\n", "def solve(seq):\n\tresult = 0\n\tprev = -1\n\tfor (i, s) in enumerate(seq):\n\t\tif s == 'R':\n\t\t\tresult = max(i - prev, result)\n\t\t\tprev = i\n\treturn result\n\ndef main():\n\tt = int(input())\n\tfor i in range(t):\n\t\tsequence = list(input())\n\t\tsequence.append('R')\n\t\tresult = solve(sequence)\n\t\tprint(result)\n\treturn 0\nmain()\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tc = 1\n\tmc = 1\n\tflag = True\n\tif s[0] == 'L':\n\t\tc += 1\n\t\tmc += 1\n\tif len(s) > 1:\n\t\tfor j in range(1, len(s)):\n\t\t\tif s[j] == 'L':\n\t\t\t\tc += 1\n\t\t\t\tif c > mc:\n\t\t\t\t\tmc = c\n\t\t\telif s[j] == 'R':\n\t\t\t\tc = 1\n\tprint(mc)\n", "from __future__ import division, print_function\n\ndef main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\tlast = -1\n\t\ts += 'R'\n\t\tn = len(s)\n\t\tmx = -1\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tmx = max(mx, i - last)\n\t\t\t\tlast = i\n\t\tcout << mx << '\\n'\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nimport os, sys\nfrom io import IOBase, BytesIO\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport sys\n\nclass ostream:\n\n\tdef __lshift__(self, a):\n\t\tsys.stdout.write(str(a))\n\t\treturn self\ncout = ostream()\nendl = '\\n'\nmain()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ta = input()\n\tcnt1 = 0\n\tcnt = 0\n\tfor x in range(len(a)):\n\t\tif a[x] == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tcnt1 = max(cnt, cnt1)\n\t\t\tcnt = 0\n\tcnt1 = max(cnt, cnt1)\n\tprint(cnt1 + 1)\n", "t = int(input())\nfor x in range(t):\n\ts = input()\n\tl = []\n\tl.append(-1)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i)\n\tl.append(len(s))\n\tres = 1\n\tfor i in range(1, len(l)):\n\t\tif res < l[i] - l[i - 1]:\n\t\t\tres = l[i] - l[i - 1]\n\tprint(res)\n", "T = int(input())\nfor t in range(T):\n\ts = input()\n\tx = 0\n\tp = -1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R' and j - p >= x:\n\t\t\tx = j - p\n\t\tif s[j] == 'R':\n\t\t\tp = j\n\tif len(s) - p > x:\n\t\tx = len(s) - p\n\tprint(x)\n", "from math import *\ninf = 10 ** 10\nzzz = int(input())\nfor zz in range(zzz):\n\ts = list(input())\n\tans = 0\n\tbal = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tbal += 1\n\t\telse:\n\t\t\tans = max(bal, ans)\n\t\t\tbal = 0\n\tans = max(bal, ans)\n\tprint(ans + 1)\n", "t = int(input())\nfor _ in range(t):\n\ta = input()\n\t(s, m, e) = (0, 0, 0)\n\tfor i in a:\n\t\tif i == 'R':\n\t\t\tbreak\n\t\ts += 1\n\ts = s + 1\n\tfor i in range(len(a) - 1, -1, -1):\n\t\tif a[i] == 'R':\n\t\t\tbreak\n\t\te += 1\n\te += 1\n\tprev = s - 1\n\tm = 0\n\tfor i in range(s, len(a)):\n\t\tif a[i] == 'R':\n\t\t\tif m < i - prev:\n\t\t\t\tm = i - prev\n\t\t\tprev = i\n\tprint(max(s, e, m))\n", "for u in range(int(input())):\n\ts = input()\n\tn = len(s)\n\t(l, ka) = (0, 0)\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tl = l + 1\n\t\telse:\n\t\t\tka = max(ka, l)\n\t\t\tl = 0\n\tif l != 0:\n\t\tka = max(ka, l)\n\tprint(ka + 1)\n", "for i in range(int(input())):\n\ts = input()\n\ts = 'R' + s\n\tini = len(s)\n\tdis = -1\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tdis = max(dis, ini - i)\n\t\t\tini = i\n\tprint(dis)\n", "from sys import stdin\nfor i in range(int(stdin.readline())):\n\ts = stdin.readline()[:-1]\n\ts = 'R' + s + 'R'\n\tL = [0]\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tL.append(i)\n\tL2 = [L[i] - L[i - 1] for i in range(1, len(L))]\n\tprint(max(L2))\n", "for i in range(int(input())):\n\ts = input()\n\tc = 0\n\tmx = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tc = c + 1\n\t\telse:\n\t\t\tc = 0\n\t\tif c > mx:\n\t\t\tmx = c\n\tprint(mx + 1)\n", "for _ in range(int(input())):\n\ts = 'R' + input() + 'R'\n\ta = [i for (i, c) in enumerate(s) if c == 'R']\n\td = [a[i] - a[i - 1] for i in range(1, len(a))]\n\tprint(max(d))\n", "import math\nt = int(input())\nfor _ in range(t):\n\tarr = list(input().strip())\n\tarr.append('R')\n\tarr.insert(0, 'R')\n\tleng = 0\n\tind = 0\n\tj = 0\n\tfor i in range(len(arr)):\n\t\tif arr[i] == 'R':\n\t\t\tind = j\n\t\t\tj = i\n\t\tif j - ind > leng:\n\t\t\tleng = j - ind\n\tprint(leng)\n", "a = int(input())\nfor i in range(a):\n\tb = input()\n\tc = len(b)\n\td = 0\n\te = 0\n\tfor j in range(c):\n\t\tif b[j] == 'R':\n\t\t\te = 0\n\t\telse:\n\t\t\te = e + 1\n\t\tif e > d:\n\t\t\td = e\n\tprint(d + 1)\n", "def solve(s):\n\tif 'L' not in s:\n\t\treturn 1\n\tif 'R' not in s:\n\t\treturn len(s) + 1\n\tans = 0\n\tr = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i)\n\tmd = 0\n\tfor i in range(len(r) - 1):\n\t\tmd = max(r[i + 1] - r[i], md)\n\treturn max(r[0] + 1, len(s) - r[-1], md)\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\ts = input()\n\t\tprint(solve(s))\nmain()\n", "for _ in range(int(input())):\n\ta = list(input())\n\tmd = 0\n\tcount = 0\n\tif a.count('R') == 0:\n\t\tprint(len(a) + 1)\n\telif a.count('L') == 0:\n\t\tprint('1')\n\telse:\n\t\trr = a[::-1].index('R') + 1\n\t\tlr = a.index('R') + 1\n\t\tfor i in range(a.index('R'), len(a) - a[::-1].index('R')):\n\t\t\tif a[i] == 'R':\n\t\t\t\tif count > md:\n\t\t\t\t\tmd = count\n\t\t\t\tcount = 0\n\t\t\telse:\n\t\t\t\tcount += 1\n\t\tprint(max(rr, lr, md + 1))\n", "import sys\nt = int(sys.stdin.readline())\nfor _ in range(t):\n\ts = sys.stdin.readline().split()[0]\n\ts = 'R' + s + 'R'\n\tprev = 0\n\tmaxi = 0\n\tacc = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmaxi = max(maxi, acc)\n\t\t\tacc = 0\n\t\telse:\n\t\t\tacc += 1\n\tprint(maxi + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tmaxGap = 0\n\tgap = 1\n\tfor c in s:\n\t\tif c == 'R':\n\t\t\tmaxGap = max(maxGap, gap)\n\t\t\tgap = 1\n\t\telse:\n\t\t\tgap += 1\n\tprint(maxGap)\n", "for _ in range(int(input())):\n\ta = input()\n\tarr = []\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tarr.append(i + 1)\n\tarr.append(len(a) + 1)\n\tans = min(arr)\n\tif len(arr) == 1:\n\t\tprint(arr[0])\n\telse:\n\t\tfor i in range(len(arr) - 1):\n\t\t\tans = max(ans, arr[i + 1] - arr[i])\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tr = [0]\n\ts = input()\n\tfor (idx, i) in enumerate(s):\n\t\tif i == 'R':\n\t\t\tr.append(idx + 1)\n\tr.append(len(s) + 1)\n\tlens = len(r)\n\tdist = 0\n\tfor i in range(lens - 1):\n\t\tdist = max(dist, r[i + 1] - r[i])\n\tprint(dist)\n", "def solve():\n\tt = int(input())\n\tfor _ in range(t):\n\t\ts = input()\n\t\ts += 'R'\n\t\tcur = 0\n\t\tmax_con = 0\n\t\tfor c in s:\n\t\t\tif c == 'R':\n\t\t\t\tmax_con = max(max_con, cur)\n\t\t\t\tcur = 0\n\t\t\telse:\n\t\t\t\tcur += 1\n\t\tprint(max_con + 1)\nsolve()\n", "t = int(input())\nfor i in range(t):\n\ts = 'R' + input()\n\tmaxd = 0\n\tref = len(s)\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R' and ref - i > maxd:\n\t\t\tmaxd = ref - i\n\t\t\tref = i\n\t\telif s[i] == 'R':\n\t\t\tref = i\n\tprint(maxd)\n", "for _ in range(int(input())):\n\tx = input()\n\tif len(x) == 1:\n\t\tif x == 'L':\n\t\t\tprint(2)\n\t\telse:\n\t\t\tprint(1)\n\telse:\n\t\tmargin = 0\n\t\tprev = -1\n\t\tfor i in range(len(x)):\n\t\t\tif x[i] == 'R' and i - prev > margin:\n\t\t\t\tmargin = i - prev\n\t\t\t\tprev = i\n\t\t\telif x[i] == 'R':\n\t\t\t\tprev = i\n\t\tif len(x) - prev > margin:\n\t\t\tmargin = len(x) - prev\n\t\tprint(margin)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tj = 0\n\tc = 0\n\tfor a in s:\n\t\tif a == 'R':\n\t\t\tc = max(c, j)\n\t\t\tj = 0\n\t\telse:\n\t\t\tj = j + 1\n\tprint(c + 1)\n", "def jumps(path):\n\t(ans, count) = (0, 1)\n\tfor e in path[::-1]:\n\t\tif e != 'R':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 1\n\t\tans = max(ans, count)\n\treturn ans\nt = int(input())\nfor _ in range(t):\n\tstring = input()\n\tprint(jumps(string))\n", "t = int(input())\nout = []\nfor i in range(0, t):\n\ts = input()\n\t(value, large) = (0, 0)\n\tfor char in s:\n\t\tif char == 'L':\n\t\t\tvalue += 1\n\t\telse:\n\t\t\tlarge = max(large, value)\n\t\t\tvalue = 0\n\tlarge = max(large, value)\n\tout.append(large + 1)\nfor x in out:\n\tprint(x)\n", "def main():\n\ts = input()\n\ts += 'R'\n\tdist = 0\n\tmax_jump = 0\n\tfor i in range(len(s)):\n\t\tdist += 1\n\t\tif s[i] == 'R':\n\t\t\tmax_jump = max(dist, max_jump)\n\t\t\tdist = 0\n\treturn max_jump\nt = int(input())\nfor _ in range(t):\n\tprint(main())\n", "def main():\n\tq = int(input())\n\tfor _ in range(q):\n\t\ts = 'R' + input() + 'R'\n\t\tlast = 0\n\t\tinc = 0\n\t\tfor x in range(len(s)):\n\t\t\tif s[x] == 'R':\n\t\t\t\tinc = max(inc, x - last)\n\t\t\t\tlast = x\n\t\tprint(inc)\nmain()\n", "def find_minimum_max_jump(string):\n\tlongest_L_seq = 0\n\tcurr = 0\n\tfor ch in string:\n\t\tif ch == 'L':\n\t\t\tcurr += 1\n\t\t\tlongest_L_seq = max(longest_L_seq, curr)\n\t\telse:\n\t\t\tcurr = 0\n\treturn longest_L_seq + 1\nt = int(input())\nfor i in range(t):\n\tstring = input()\n\tprint(find_minimum_max_jump(string))\n", "def q():\n\ta = input()\n\tp = a.find('R') + 1\n\tb = []\n\ta = list(a)\n\tc = len(a)\n\tif c == 1 and a[0] == 'R':\n\t\tprint(1)\n\t\treturn 0\n\telif c == 1 and a[0] == 'L':\n\t\tprint(2)\n\t\treturn 0\n\telse:\n\t\tfor i in range(c):\n\t\t\tif a[i] == 'R':\n\t\t\t\tb.append(i)\n\t\tif len(b) == 1:\n\t\t\tif a.index('R') + 1 > c - b[0]:\n\t\t\t\tprint(a.index('R') + 1)\n\t\t\telse:\n\t\t\t\tprint(c - b[0])\n\t\t\treturn 0\n\t\tif len(b) == 0:\n\t\t\tprint(c + 1)\n\t\t\treturn 0\n\t\tb.reverse()\n\t\tfor i in range(len(b) - 1):\n\t\t\tb[i] = b[i] - b[i + 1]\n\t\te = max(b)\n\t\td = list(a)[:]\n\t\td.reverse()\n\t\tr = d.index('R')\n\t\tprint(max(p, r + 1, e))\n\t\treturn 0\na = eval(input())\nfor i in range(a):\n\tq()\n", "n = int(input())\nfor i in range(n):\n\tl = list(input())\n\tmx = 1\n\tstreak = 1\n\tfor j in range(len(l)):\n\t\tif l[j] == 'R':\n\t\t\tmx = max(mx, streak)\n\t\t\tstreak = 1\n\t\telse:\n\t\t\tstreak += 1\n\tmx = max(mx, streak)\n\tprint(mx)\n", "def rec(s):\n\tsteps = 1\n\tl = []\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tsteps += 1\n\t\telse:\n\t\t\tl.append(steps)\n\t\t\tsteps = 1\n\tl.append(steps)\n\treturn max(l)\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tprint(rec(s))\n", "for _ in range(int(input())):\n\ts = input()\n\tlast = -1\n\ts += 'R'\n\tn = len(s)\n\tmx = -1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tmx = max(mx, i - last)\n\t\t\tlast = i\n\tprint(mx)\n", "def find(val):\n\tli = list(val)\n\tli.append('R')\n\tli = ['R'] + li\n\tindex = 0\n\tans = float('-inf')\n\tfor i in range(len(li)):\n\t\tif li[i] == 'R':\n\t\t\tans = max(ans, i - index)\n\t\t\tindex = i\n\treturn ans\nx = int(input())\nfor i in range(x):\n\tprint(find(input()))\n", "def find_answer(lenth):\n\tans = 0\n\ta = 1\n\tfor i in lenth:\n\t\tif i == 'L':\n\t\t\ta += 1\n\t\telse:\n\t\t\tans = max(ans, a)\n\t\t\ta = 1\n\tans = max(ans, a)\n\tprint(ans)\nn = int(input())\nfor i in range(n):\n\ta = input()\n\tfind_answer(a)\n", "for i in range(int(input())):\n\tl = input()\n\tle = len(l)\n\td = -1\n\tj = -1\n\tk = -1\n\tfor i in range(le):\n\t\tif l[i] == 'R':\n\t\t\td = max(abs(j - k), d)\n\t\t\t(j, k) = (k, i)\n\td = max(abs(j - k), d)\n\td = max(d, abs(le - k))\n\tif d == -1:\n\t\tprint(le + 1)\n\telse:\n\t\tprint(d)\n", "test = int(input())\nfor index in range(0, test):\n\tinp = input()\n\ttemp = []\n\ttemp.append(0)\n\tnum = len(inp)\n\tfor index in range(0, num):\n\t\tif inp[index] == 'R':\n\t\t\ttemp.append(index + 1)\n\ttemp.append(num + 1)\n\tmaximum = 0\n\tlamba = len(temp)\n\tfor index in range(0, lamba - 1):\n\t\tmaximum = max(temp[index + 1] - temp[index], maximum)\n\tprint(maximum)\n", "import sys\nall_data = sys.stdin.readline()\nn = int(all_data)\nfor i in range(1, n + 1):\n\ts = sys.stdin.readline()\n\ts = 'R' + s[-1::-1] + 'R'\n\tmax_dis = 0\n\tlast = 1\n\tfor j in range(1, len(s)):\n\t\tif s[j] == 'R':\n\t\t\tmax_dis = max(j - last, max_dis)\n\t\t\tlast = j\n\tprint(max_dis)\n", "t = int(input())\nl1 = []\nfor i in range(t):\n\tl = []\n\ts = input()\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tl.append(j)\n\tl1.append([l, len(s)])\nfor i in l1:\n\tif len(i[0]) == 0:\n\t\tprint(i[1] + 1)\n\telse:\n\t\tl2 = [i[0][0] + 1]\n\t\tfor j in range(1, len(i[0])):\n\t\t\tl2.append(i[0][j] - i[0][j - 1])\n\t\tl2.append(i[1] - i[0][-1])\n\t\tl2.sort()\n\t\tprint(l2[-1])\n", "import sys\nfrom sys import stdin, stdout\nimport bisect\nimport math\nimport heapq\n\ndef modinv(n, p):\n\treturn pow(n, p - 2, p)\n\ndef cin():\n\treturn map(int, sin().split())\n\ndef ain():\n\treturn list(map(int, sin().split()))\n\ndef sin():\n\treturn input()\n\ndef inin():\n\treturn int(input())\nimport math\n\ndef Divisors(n):\n\tl = []\n\tfor i in range(1, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n // i == i:\n\t\t\t\tl.append(i)\n\t\t\telse:\n\t\t\t\tl.append(i)\n\t\t\t\tl.append(n // i)\n\treturn l\nimport statistics\n\ndef main():\n\tt = inin()\n\tfor _ in range(t):\n\t\ts = sin()\n\t\ta = []\n\t\tn = len(s)\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\ta.append(i + 1)\n\t\tx = y = 0\n\t\ta.append(n + 1)\n\t\tfor i in a:\n\t\t\ty = max(i - x, y)\n\t\t\tx = i\n\t\tprint(y)\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nimport os, sys\nfrom io import IOBase, BytesIO\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport sys\n\nclass ostream:\n\n\tdef __lshift__(self, a):\n\t\tsys.stdout.write(str(a))\n\t\treturn self\ncout = ostream()\nendl = '\\n'\n\ndef readnumbers(zero=0):\n\tconv = ord if py2 else lambda x: x\n\tA = []\n\tnumb = zero\n\tsign = 1\n\ti = 0\n\ts = sys.stdin.buffer.read()\n\ttry:\n\t\twhile True:\n\t\t\tif s[i] >= b'0'[0]:\n\t\t\t\tnumb = 10 * numb + conv(s[i]) - 48\n\t\t\telif s[i] == b'-'[0]:\n\t\t\t\tsign = -1\n\t\t\telif s[i] != b'\\r'[0]:\n\t\t\t\tA.append(sign * numb)\n\t\t\t\tnumb = zero\n\t\t\t\tsign = 1\n\t\t\ti += 1\n\texcept:\n\t\tpass\n\tif s and s[-1] >= b'0'[0]:\n\t\tA.append(sign * numb)\n\treturn A\nmain()\n", "from sys import *\nfor _ in range(int(stdin.readline())):\n\ts = stdin.readline()\n\tl = []\n\tk = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i - k)\n\t\t\tk = i\n\tl.append(len(s) - k - 1)\n\tprint(max(l))\n", "test_count = int(input())\nfor i in range(test_count):\n\tline = input()\n\trPoses = [-1]\n\tfor j in range(len(line)):\n\t\tif line[j] == 'R':\n\t\t\trPoses.append(j)\n\trPoses.append(len(line))\n\tdiffs = []\n\tlast = rPoses[0]\n\tfor j in range(1, len(rPoses)):\n\t\tdiffs.append(rPoses[j] - last)\n\t\tlast = rPoses[j]\n\tprint(max(diffs))\n", "n = int(input())\nfor i in range(n):\n\tl = list(map(len, input().split('R')))\n\tprint(max(l) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\t(ans, tempL) = (0, 0)\n\tfor c in s:\n\t\tif c == 'L':\n\t\t\ttempL += 1\n\t\telse:\n\t\t\tans = max(ans, tempL)\n\t\t\ttempL = 0\n\tprint(max(ans, tempL) + 1)\n", "t = int(input())\nwhile t:\n\ts = input()\n\tcur = 0\n\ttot = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif cur > tot:\n\t\t\t\ttot = cur\n\t\t\tcur = 0\n\t\telse:\n\t\t\tcur += 1\n\t\t\tif cur > tot:\n\t\t\t\ttot = cur\n\tprint(tot + 1)\n\tt -= 1\n", "for _ in range(int(input())):\n\ts = list(input())\n\tr = -1\n\tm = 0\n\tl = len(s)\n\tfor i in range(l):\n\t\tif s[i] == 'R':\n\t\t\tm = max(m, i - r)\n\t\t\tr = i\n\tm = max(m, l - r)\n\tprint(m)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ta = input()\n\tn = len(a)\n\tinds = [-1]\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tinds.append(i)\n\tinds.append(n)\n\tans = 0\n\tfor i in range(1, len(inds)):\n\t\tans = max(ans, inds[i] - inds[i - 1])\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tl = False\n\tfirst_l = -1\n\td = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tif first_l == -1:\n\t\t\t\tfirst_l = i\n\t\t\t\tl = True\n\t\telif l:\n\t\t\td = max(i - first_l + 1, d)\n\t\t\tl = False\n\t\t\tfirst_l = -1\n\tif first_l > -1:\n\t\td = max(len(s) - first_l + 1, d)\n\tprint(d)\n", "import sys\nfor _ in range(int(sys.stdin.readline().rstrip())):\n\tarr = list(sys.stdin.readline().rstrip())\n\trcnt = arr.count('R')\n\tif rcnt == 0:\n\t\tprint(len(arr) + 1)\n\t\tcontinue\n\tbefore = -1\n\tterm = -1\n\tfor i in range(len(arr)):\n\t\tif arr[i] == 'R':\n\t\t\tterm = max(term, i - before)\n\t\t\tbefore = i\n\tterm = max(term, len(arr) - before)\n\tprint(term)\n", "from __future__ import division, print_function\nimport os, sys\nfrom io import BytesIO, IOBase\nif sys.version_info[0] < 3:\n\tfrom __builtin__ import xrange as range\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\ndef ii():\n\treturn int(input())\n\ndef si():\n\treturn input()\n\ndef mi():\n\treturn map(int, input().strip().split(' '))\n\ndef msi():\n\treturn map(str, input().strip().split(' '))\n\ndef li():\n\treturn list(mi())\n\ndef dmain():\n\tsys.setrecursionlimit(100000000)\n\tthreading.stack_size(40960000)\n\tthread = threading.Thread(target=main)\n\tthread.start()\nabc = 'abcdefghijklmnopqrstuvwxyz'\nabd = {'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}\nmod = 1000000007\ninf = float('inf')\nvow = ['a', 'e', 'i', 'o', 'u']\n(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])\n\ndef getKey(item):\n\treturn item[1]\n\ndef sort2(l):\n\treturn sorted(l, key=getKey, reverse=True)\n\ndef d2(n, m, num):\n\treturn [[num for x in range(m)] for y in range(n)]\n\ndef isPowerOfTwo(x):\n\treturn x and (not x & x - 1)\n\ndef decimalToBinary(n):\n\treturn bin(n).replace('0b', '')\n\ndef ntl(n):\n\treturn [int(i) for i in str(n)]\n\ndef ncr(n, r):\n\treturn factorial(n) // (factorial(r) * factorial(n - r))\n\ndef powerMod(x, y, p):\n\tres = 1\n\tx %= p\n\twhile y > 0:\n\t\tif y & 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef gcd(x, y):\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef isPrime(n):\n\tif n <= 1:\n\t\treturn False\n\tif n <= 3:\n\t\treturn True\n\tif n % 2 == 0 or n % 3 == 0:\n\t\treturn False\n\ti = 5\n\twhile i * i <= n:\n\t\tif n % i == 0 or n % (i + 2) == 0:\n\t\t\treturn False\n\t\ti = i + 6\n\treturn True\n\ndef read():\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\ndef main():\n\tfor _ in range(ii()):\n\t\ts = si()\n\t\tn = len(s)\n\t\tx = [0]\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tx.append(i + 1)\n\t\tx.append(n + 1)\n\t\tans = 0\n\t\tfor i in range(len(x) - 1):\n\t\t\tans = max(ans, x[i + 1] - x[i])\n\t\tprint(ans)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "k = int(input())\nfor i in range(k):\n\ts = 'R' + input() + 'R'\n\tm = 0\n\t(x, y) = (0, 0)\n\tfor p in range(len(s)):\n\t\tif s[p] == 'R':\n\t\t\t(x, y) = (y, p)\n\t\t\tif y - x > m:\n\t\t\t\tm = y - x\n\tprint(m)\n", "for t in range(int(input())):\n\tarr = list(input())\n\tif arr.count('R') == 0:\n\t\tprint(len(arr) + 1)\n\telif arr.count('R') == len(arr):\n\t\tprint(1)\n\telse:\n\t\tpos = [0, len(arr) + 1]\n\t\tfor i in range(len(arr)):\n\t\t\tele = arr[i]\n\t\t\tif ele == 'R':\n\t\t\t\tpos.append(i + 1)\n\t\t\telse:\n\t\t\t\tcontinue\n\t\tpos.sort()\n\t\tmaxim = 0\n\t\tfor i in range(1, len(pos)):\n\t\t\tdiff = pos[i] - pos[i - 1]\n\t\t\tmaxim = max(maxim, diff)\n\t\tprint(maxim)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tl = len(s)\n\ta = [0]\n\tfor j in range(l):\n\t\tif s[j] == 'L':\n\t\t\tcontinue\n\t\tfor k in range(j + 1, l):\n\t\t\tif s[k] == 'R':\n\t\t\t\ta.append(k - j)\n\t\t\t\tbreak\n\tans = max(a)\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input() + 'R'\n\tr_p = -1\n\tm = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - r_p > m:\n\t\t\t\tm = i - r_p\n\t\t\tr_p = i\n\tprint(m)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tcurr = 0\n\tres = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcurr += 1\n\t\tif s[i] == 'R':\n\t\t\tres = max(res, curr)\n\t\t\tcurr = 0\n\tres = max(res, curr)\n\tprint(res + 1)\n", "t = int(input())\nfor k in range(t):\n\ts = input()\n\tprev = -1\n\tbest_d = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tbest_d = max(best_d, i - prev)\n\t\t\tprev = i\n\tif best_d == -1:\n\t\tbest_d = len(s) + 1\n\telse:\n\t\tbest_d = max(best_d, len(s) - prev)\n\tprint(best_d)\n", "T = int(input())\nans = ''\nfor _ in range(T):\n\ts = input()\n\tk = 1\n\tt = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tt += 1\n\t\telse:\n\t\t\tk = max(k, t)\n\t\t\tt = 1\n\tans += str(max(k, t)) + '\\n'\nprint(ans)\n", "p = int(input())\nfor q in range(p):\n\tentrada = input()\n\tsub = ''\n\tcont = 0\n\tmaior = 0\n\tfor k in range(len(entrada)):\n\t\tif entrada[k] == 'L':\n\t\t\tcont += 1\n\t\telse:\n\t\t\tif cont > maior:\n\t\t\t\tmaior = cont\n\t\t\tcont = 0\n\tif cont > maior:\n\t\tmaior = cont\n\tprint(maior + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = str(input())\n\tl = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\tp = []\n\tfor j in range(len(l) - 1):\n\t\tp.append(l[j + 1] - l[j])\n\tprint(max(p))\n", "from sys import stdin\n\ndef inp():\n\treturn (ss.rstrip() for ss in stdin).__next__()\n\ndef itg():\n\treturn int(stdin.buffer.readline())\n\ndef mpint():\n\treturn map(int, stdin.buffer.readline().split())\nfor case in range(itg()):\n\ts = 'R' + inp() + 'R'\n\tlast = 0\n\tans = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tlast = i\n\t\tans = max(ans, i - last)\n\tprint(ans + 1)\n", "for t in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tcnt = 0\n\tres = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tres = max(cnt, res)\n\t\t\tcnt = 0\n\tres = max(cnt, res)\n\tprint(res + 1)\n", "t = int(input())\nfor l in range(t):\n\ta = input()\n\ti = 1\n\tnum = []\n\tc = 0\n\tfor k in a:\n\t\tif k == 'R':\n\t\t\tnum.append(i - c)\n\t\t\tc = i\n\t\ti += 1\n\tnum.append(i - c)\n\tprint(max(num))\n", "for _ in range(int(input())):\n\tkq = 0\n\ts = 'R' + input() + 'R'\n\ti = 0\n\tn = len(s) - 2\n\twhile i <= n:\n\t\tif s[i] == 'R':\n\t\t\ti += 1\n\t\t\tcontinue\n\t\tdem = 1\n\t\twhile s[i] == 'L' and s[i + 1] == 'L':\n\t\t\ti += 1\n\t\t\tdem += 1\n\t\tkq = max(kq, dem)\n\t\ti += 1\n\tprint(kq + 1)\n", "from sys import stdin, stdout\nfrom collections import deque, defaultdict\nrl = lambda : stdin.readline()\nrll = lambda : stdin.readline().split()\n\ndef can_reach(s, d):\n\t(seen, M, m) = (set(), float('-inf'), float('inf'))\n\tQ = deque([-1])\n\twhile Q:\n\t\tcurr = Q.pop()\n\t\tif curr in seen:\n\t\t\tcontinue\n\t\tseen.add(curr)\n\t\tif curr == -1 or s[curr] == 'R':\n\t\t\tif curr + d >= len(s):\n\t\t\t\treturn True\n\t\t\tfor j in range(max(M, curr + 1), min(len(s), curr + d + 1)):\n\t\t\t\tif j not in seen:\n\t\t\t\t\tQ.appendleft(j)\n\t\t\tM = max(M, curr + d)\n\t\telse:\n\t\t\tfor j in range(max(0, curr - d), min(curr, m)):\n\t\t\t\tif j not in seen:\n\t\t\t\t\tQ.appendleft(j)\n\t\t\tm = min(m, curr - d)\n\treturn False\n\ndef main():\n\tT = int(rl())\n\tfor _ in range(T):\n\t\ts = rll()[0]\n\t\tn = len(s)\n\t\t(d, jump) = (n + 1, n + 1)\n\t\twhile jump >= 1:\n\t\t\twhile d - jump >= 1 and can_reach(s, d - jump):\n\t\t\t\td -= jump\n\t\t\tjump //= 2\n\t\tstdout.write(str(d))\n\t\tstdout.write('\\n')\n\tstdout.close()\nmain()\n", "T = int(input().strip())\nfor t in range(T):\n\tS = str(input().strip())\n\tmaxL = 0\n\tcurrL = 0\n\tfor s in S:\n\t\tif s == 'L':\n\t\t\tcurrL += 1\n\t\telse:\n\t\t\tif currL > maxL:\n\t\t\t\tmaxL = currL\n\t\t\tcurrL = 0\n\tif currL > maxL:\n\t\tmaxL = currL\n\tprint(maxL + 1)\n", "N = int(input())\nfor i in range(N):\n\ts = input()\n\tcountL = 0\n\tmax = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tcountL = countL + 1\n\t\t\tif countL > max:\n\t\t\t\tmax = countL\n\t\telse:\n\t\t\tcountL = 0\n\tprint(max + 1)\n", "t = int(input())\n\ndef find_greater_distance(way):\n\ti = -1\n\tdistance = 0\n\tfor j in range(len(way)):\n\t\tif way[j] == 'R':\n\t\t\tif j - i > distance:\n\t\t\t\tdistance = j - i\n\t\t\ti = j\n\treturn len(way) - i if len(way) - i > distance else distance\nfor _ in range(t):\n\ts = input()\n\tprint(find_greater_distance(s))\n", "t = int(input())\n\ndef find(a):\n\tfor i in range(len(a)):\n\t\tif a[i] == 1:\n\t\t\treturn i + 1\n\treturn len(a) + 1\nfor i in range(t):\n\ts = str(input())\n\ta = []\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\ta.append(0)\n\t\telse:\n\t\t\ta.append(1)\n\tn = len(a)\n\tm = -1\n\tans = []\n\tfor j in range(n):\n\t\tif a[j] == 1:\n\t\t\tans.append(j - m)\n\t\t\tm = j\n\tans.append(n - m)\n\tprint(max(ans))\n", "T = int(input())\nfor i in range(T):\n\ts = input()\n\tl = [0] * len(s)\n\td = -1\n\tg = 1\n\tm = 0\n\tc = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tc = c + 1\n\t\telse:\n\t\t\tif m < c:\n\t\t\t\tm = c\n\t\t\tc = 0\n\tif c != 0:\n\t\tif c > m:\n\t\t\tm = c\n\tprint(m + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = str(input())\n\td = 0\n\tlast = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td = max(i + 1 - last, d)\n\t\t\tlast = i + 1\n\tprint(max(d, len(s) + 1 - last))\n", "for _ in range(int(input())):\n\ts = input()\n\tans = s.find('R')\n\tif ans == -1:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tans += 1\n\t\tfirst = ans - 1\n\t\ttemp = ans\n\t\tfor i in range(temp, len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tans = max(ans, i - first)\n\t\t\t\tfirst = i\n\t\tans = max(ans, len(s) - first)\n\t\tprint(ans)\n", "from itertools import groupby\nfor _ in range(int(input())):\n\ts = input()\n\tl = [(k, len(list(v))) for (k, v) in groupby(s)]\n\tif len(l) == 1 and l[0][0] == 'R' or not len(l):\n\t\tprint(1)\n\telse:\n\t\tprint(max((__ for (_, __) in l if _ == 'L')) + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tm = 0\n\tj = 0\n\tm1 = 0\n\twhile j < len(s):\n\t\tif s[j] == 'L':\n\t\t\tm1 += 1\n\t\telse:\n\t\t\tm = max(m1, m)\n\t\t\tm1 = 0\n\t\tj += 1\n\tm = max(m1, m)\n\tprint(m + 1)\n", "x = int(input())\nwhile x:\n\tx -= 1\n\ts = input()\n\ta = s.split('R')\n\tprint(len(max(a)) + 1)\n", "a = int(input())\nfor i in range(a):\n\ts = input()\n\tans = [-1]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans.append(i)\n\tgam = []\n\tfor i in range(1, len(ans)):\n\t\tgam.append(ans[i] - ans[i - 1])\n\tgam.append(len(s) - ans[-1])\n\tif len(gam) == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tprint(max(gam))\n", "def main():\n\tt = int(input())\n\tfor __ in range(t):\n\t\ts = input()\n\t\tn = len(s)\n\t\tr = []\n\t\tfound = False\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tr.append(i + 1)\n\t\t\t\tfound = True\n\t\tif found:\n\t\t\td = r[0]\n\t\t\tj = r[0]\n\t\t\tm = len(r)\n\t\t\tfor i in range(1, m):\n\t\t\t\tif j + d < r[i]:\n\t\t\t\t\td += r[i] - (j + d)\n\t\t\t\t\tj = r[i]\n\t\t\t\telse:\n\t\t\t\t\tj = r[i]\n\t\t\tif j + d < n + 1:\n\t\t\t\td += n + 1 - (j + d)\n\t\t\tprint(d)\n\t\telse:\n\t\t\tprint(n + 1)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\tl = list(input())\n\tan = 0\n\ti = 0\n\twhile i < len(l):\n\t\tif l[i] == 'L':\n\t\t\tj = i\n\t\t\twhile i != len(l) - 1 and l[i + 1] == 'L':\n\t\t\t\ti += 1\n\t\t\tan = max(i + 1 - j, an)\n\t\ti += 1\n\tprint(an + 1)\n", "n = int(input())\nwhile n > 0:\n\ta = input()\n\tl = []\n\tx = 0\n\tl.append(0)\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(a) + 1)\n\tfor j in range(1, len(l)):\n\t\td = l[j] - l[j - 1]\n\t\tif d > x:\n\t\t\tx = d\n\tprint(x)\n\tn = n - 1\n", "def fun(s):\n\tcnt = 0\n\ta = []\n\tfor i in range(len(s)):\n\t\tcnt += 1\n\t\tif s[i] == 'R':\n\t\t\ta.append(cnt)\n\t\t\tcnt = 0\n\ta.append(cnt + 1)\n\tprint(max(a))\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tfun(s)\n", "for t in range(int(input())):\n\ts = list(map(str, input()))\n\tl = ['R']\n\tl = l + s\n\tl.append('R')\n\tk = []\n\tn = 0\n\tfor i in range(len(l)):\n\t\tif l[i] == 'R':\n\t\t\tk.append(i)\n\tfor j in range(len(k) - 1):\n\t\tif k[j + 1] - k[j] > n:\n\t\t\tn = k[j + 1] - k[j]\n\tprint(n)\n", "def solution(frase):\n\tinicio = 0\n\tfim = len(frase) + 1\n\tmeio = int((inicio + fim) / 2)\n\tcandidate = 0\n\twhile inicio <= fim and fim:\n\t\tif chega(frase, meio):\n\t\t\tfim = meio - 1\n\t\t\tcandidate = meio\n\t\telse:\n\t\t\tinicio = meio + 1\n\t\tmeio = meio = int((inicio + fim) / 2)\n\treturn candidate\n\ndef chega(frase, meio):\n\tfrase = '-' + frase + ' '\n\tpostion = 0\n\ttamanho = meio\n\twhile frase[postion] != ' ' and tamanho > 0:\n\t\tif postion + tamanho > len(frase) - 1:\n\t\t\ttamanho -= 1\n\t\telif frase[postion + tamanho] == 'R' or frase[postion + tamanho] == ' ':\n\t\t\tpostion += tamanho\n\t\t\ttamanho = meio\n\t\telse:\n\t\t\ttamanho -= 1\n\tif frase[postion] == ' ':\n\t\treturn True\n\telse:\n\t\treturn False\nn_casos = int(input())\ncasos = []\nfor i in range(n_casos):\n\tcasos.append(input())\nfor caso in casos:\n\tprint(solution(caso))\n", "t = int(input())\nfor i in range(t):\n\tstring = input()\n\tcounter = 0\n\tk = 0\n\tfor j in range(0, len(string)):\n\t\tif string[j] == 'L':\n\t\t\tcounter = counter + 1\n\t\tif counter > k:\n\t\t\tk = counter\n\t\tif string[j] == 'R':\n\t\t\tcounter = 0\n\tprint(k + 1)\n", "def frog(string):\n\tl = len(string)\n\tif 'R' not in string:\n\t\treturn l + 1\n\telse:\n\t\ts = 0\n\t\tlast_r = 0\n\t\tfor (i, x) in enumerate(string):\n\t\t\tif x == 'R':\n\t\t\t\tnew_s = i + 1 - last_r\n\t\t\t\tlast_r = i + 1\n\t\t\t\tif new_s > s:\n\t\t\t\t\ts = new_s\n\t\tif l - last_r + 1 > s:\n\t\t\ts = l - last_r + 1\n\t\treturn s\nt = int(input())\narray = []\nfor i in range(t):\n\tarray.append(input())\nfor x in array:\n\tprint(frog(x))\n", "import sys\nfrom collections import Counter\n\ndef main():\n\tfor _ in range(int(sys.stdin.readline())):\n\t\tn = sys.stdin.readline()\n\t\tn = list(n)\n\t\tn.pop()\n\t\tn.append('R')\n\t\tn.insert(0, 'R')\n\t\tx = len(n)\n\t\tl = []\n\t\tfor i in range(x):\n\t\t\tif n[i] == 'R':\n\t\t\t\tl.append(i)\n\t\tif len(l) == 2:\n\t\t\tprint(x - 1)\n\t\telse:\n\t\t\tans = -1\n\t\t\tfor i in range(len(l) - 1):\n\t\t\t\tx = l[i + 1] - l[i]\n\t\t\t\tif x > ans:\n\t\t\t\t\tans = x\n\t\t\tprint(ans)\nmain()\n", "from collections import Counter, defaultdict, deque\nfrom heapq import heappop, heappush, heapify\nimport sys, bisect, math, itertools, fractions, pprint\nsys.setrecursionlimit(10 ** 8)\nmod = 10 ** 9 + 7\nINF = float('inf')\n\ndef inp():\n\treturn int(sys.stdin.readline())\n\ndef inpl():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef inpln(n):\n\treturn list((int(sys.stdin.readline()) for i in range(n)))\nT = inp()\nfor _ in range(T):\n\ta = input()\n\tres = 0\n\tcnt = 0\n\tfor (i, t) in enumerate(a):\n\t\tif t == 'L':\n\t\t\tcnt += 1\n\t\t\tres = max(cnt, res)\n\t\telse:\n\t\t\tcnt = 0\n\tprint(res + 1)\n", "I = input\npr = print\nar = []\nexec(int(I()) * 'ar.append(I());')\nfor x in ar:\n\tm = t = 0\n\tfor y in x:\n\t\tif y == 'L':\n\t\t\tt += 1\n\t\telse:\n\t\t\tm = max(m, t)\n\t\t\tt = 0\n\t\tm = max(m, t)\n\tprint(m + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = list(input())\n\tma = 0\n\tcount = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > ma:\n\t\t\t\tma = count\n\t\t\tcount = 0\n\tif count > ma:\n\t\tma = count\n\tprint(ma + 1)\n", "t = int(input())\nres = []\nfor z in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tres.append(0)\n\tfor i in range(len(s) - 1):\n\t\tif s[i] == 'R':\n\t\t\tj = i + 1\n\t\t\twhile s[j] != 'R':\n\t\t\t\tj += 1\n\t\t\tif res[z] < j - i:\n\t\t\t\tres[z] = j - i\nfor i in range(t):\n\tprint(res[i])\n", "testes = int(input())\nrespostas = []\nfor _ in range(testes):\n\trespostas.append(len(sorted(input().split('R'), reverse=True)[0]) + 1)\nfor resp in respostas:\n\tprint(resp)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tans = 1\n\tanstmp = 1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans = max(anstmp, ans)\n\t\t\tanstmp = 1\n\t\telse:\n\t\t\tanstmp += 1\n\tans = max(anstmp, ans)\n\tprint(ans)\n", "T = int(input())\nfor t in range(T):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tmaxd = 0\n\tlast = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - last > maxd:\n\t\t\t\tmaxd = i - last\n\t\t\tlast = i\n\tprint(maxd)\n", "for nt in range(int(input())):\n\ts = 'R' + input() + 'R'\n\tgap = 0\n\tprev = 'R'\n\tcount = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'L' and prev == 'R':\n\t\t\tcount = 1\n\t\t\tprev = 'L'\n\t\telif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > gap:\n\t\t\t\tgap = count\n\t\t\tcount = 0\n\tprint(gap + 1)\n", "R = lambda : map(int, input().split())\nfrom collections import defaultdict\nt = int(input())\n\ndef solve(a):\n\tcount = 0\n\tlongest = 0\n\tfor i in range(len(a)):\n\t\tif a[i] == 'L':\n\t\t\tcount += 1\n\t\tif i == len(a) - 1 or a[i] == 'R':\n\t\t\tlongest = max(longest, count)\n\t\t\tcount = 0\n\treturn longest + 1\nfor _ in range(t):\n\ta = input()\n\tprint(solve(a))\n", "def min_jump_limit(directions):\n\tmax_left_count = 0\n\tleft_count = 0\n\tfor direction in directions:\n\t\tif direction == 'R':\n\t\t\tleft_count = 0\n\t\t\tcontinue\n\t\tif direction == 'L':\n\t\t\tleft_count += 1\n\t\t\tmax_left_count = max(max_left_count, left_count)\n\t\t\tcontinue\n\t\traise Exception('invalid direction')\n\treturn max_left_count + 1\nnumber_of_tests = int(input())\nfor _ in range(number_of_tests):\n\tdirections = input()\n\tresult = min_jump_limit(directions)\n\tprint(result)\n", "from fractions import Fraction\nfrom collections import defaultdict\nimport math\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\ndef input():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tr = []\n\tr.append(0)\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(n + 1)\n\tmin = 0\n\tfor j in range(1, len(r)):\n\t\tmin = max(min, r[j] - r[j - 1])\n\tprint(min)\n", "from sys import stdin\ntry:\n\tfor _ in range(int(stdin.readline())):\n\t\ts = stdin.readline().rstrip()\n\t\tarr = [0 if ele == 'R' else 1 for ele in s]\n\t\t(n, ind, d) = (len(s), 0, 0)\n\t\tif 0 in arr:\n\t\t\tind = arr.index(0)\n\t\t\td = ind + 1\n\t\tif 0 not in arr:\n\t\t\tprint(n + 1)\n\t\telif sum(arr[ind:]) == 0:\n\t\t\tprint(d)\n\t\telse:\n\t\t\t(l, count) = ([], 0)\n\t\t\tarr.append(0)\n\t\t\tfor ele in arr:\n\t\t\t\tif ele == 0:\n\t\t\t\t\tl += [count]\n\t\t\t\t\tcount = 0\n\t\t\t\telse:\n\t\t\t\t\tcount += 1\n\t\t\tprint(max(l) + 1)\nexcept:\n\tpass\n", "for _ in range(int(input())):\n\ts = input()\n\tKK = s.split('R')\n\tl = list(map(len, KK))\n\tm = 0\n\tfor i in l:\n\t\tif i > m:\n\t\t\tm = i\n\tprint(m + 1)\n", "n = int(input())\nfor p in range(n):\n\ts = 'R' + input() + 'R'\n\t(m, I) = (0, 0)\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max(i - I, m)\n\t\t\tI = i\n\tprint(m)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = 1\n\tm = 0\n\tfor i in range(len(s)):\n\t\tif s[i] != 'R':\n\t\t\tn += 1\n\t\telse:\n\t\t\tn = 1\n\t\tif n > m:\n\t\t\tm = n\n\tprint(m)\n", "import sys\nimport math\nimport itertools\nimport functools\nimport collections\nimport operator\nimport fileinput\nimport copy\nORDA = 97\n\ndef ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef lcm(a, b):\n\treturn abs(a * b) // math.gcd(a, b)\n\ndef revn(n):\n\treturn str(n)[::-1]\n\ndef dd():\n\treturn collections.defaultdict(int)\n\ndef ddl():\n\treturn collections.defaultdict(list)\n\ndef sieve(n):\n\tif n < 2:\n\t\treturn list()\n\tprime = [True for _ in range(n + 1)]\n\tp = 3\n\twhile p * p <= n:\n\t\tif prime[p]:\n\t\t\tfor i in range(p * 2, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 2\n\tr = [2]\n\tfor p in range(3, n + 1, 2):\n\t\tif prime[p]:\n\t\t\tr.append(p)\n\treturn r\n\ndef divs(n, start=1):\n\tr = []\n\tfor i in range(start, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n / i == i:\n\t\t\t\tr.append(i)\n\t\t\telse:\n\t\t\t\tr.extend([i, n // i])\n\treturn r\n\ndef divn(n, primes):\n\tdivs_number = 1\n\tfor i in primes:\n\t\tif n == 1:\n\t\t\treturn divs_number\n\t\tt = 1\n\t\twhile n % i == 0:\n\t\t\tt += 1\n\t\t\tn //= i\n\t\tdivs_number *= t\n\ndef prime(n):\n\tif n == 2:\n\t\treturn True\n\tif n % 2 == 0 or n <= 1:\n\t\treturn False\n\tsqr = int(math.sqrt(n)) + 1\n\tfor d in range(3, sqr, 2):\n\t\tif n % d == 0:\n\t\t\treturn False\n\treturn True\n\ndef convn(number, base):\n\tnewnumber = 0\n\twhile number > 0:\n\t\tnewnumber += number % base\n\t\tnumber //= base\n\treturn newnumber\n\ndef cdiv(n, k):\n\treturn n // k + (n % k != 0)\nfor _ in range(ii()):\n\ts = input()\n\tans = 0\n\tlens = len(s)\n\ti = 0\n\twhile i < len(s):\n\t\tt = 0\n\t\twhile i < lens and s[i] == 'L':\n\t\t\tt += 1\n\t\t\ti += 1\n\t\tans = max(ans, t)\n\t\ti += 1\n\tprint(max(1, ans + 1))\n", "def solve():\n\ts = input()\n\tn = len(s)\n\tans = 0\n\tm = 0\n\tt = s[0]\n\tif t == 'L':\n\t\tm = 1\n\t\tans = 1\n\tfor i in range(1, n):\n\t\tif s[i] == 'L':\n\t\t\tm += 1\n\t\t\tans = max(ans, m)\n\t\telse:\n\t\t\tm = 0\n\treturn ans + 1\nfor _ in range(int(input())):\n\tprint(solve())\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tma = 0\n\tco = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tco = 0\n\t\telse:\n\t\t\tco += 1\n\t\tma = max(co, ma)\n\tprint(ma + 1)\n", "def check_l(string):\n\toutput = 0\n\tcon = 0\n\tfor i in range(len(string)):\n\t\tif con > 0:\n\t\t\tcon -= 1\n\t\t\tcontinue\n\t\tif string[i] == 'L':\n\t\t\tmaximum = 1\n\t\t\tfor j in range(i + 1, len(string)):\n\t\t\t\tif string[j] == 'L':\n\t\t\t\t\tmaximum += 1\n\t\t\t\t\tcon += 1\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\tif maximum > output:\n\t\t\t\toutput = maximum\n\tif output == 0:\n\t\treturn output + 1\n\treturn output + 1\n\ndef frog_jumps():\n\tcases = int(input())\n\tstrings = []\n\tfor i in range(cases):\n\t\tstrings.append(input())\n\tfor i in range(len(strings)):\n\t\tjump = check_l(strings[i])\n\t\tprint(jump)\nfrog_jumps()\n", "import sys\ninput = sys.stdin.readline\nQ = int(input())\nQuery = [list(input().rstrip()) for _ in range(Q)]\nfor S in Query:\n\ttmp = 0\n\tans = 0\n\tfor (i, s) in enumerate(S):\n\t\tif s == 'L':\n\t\t\ttmp += 1\n\t\telse:\n\t\t\tans = max(tmp + 1, ans)\n\t\t\ttmp = 0\n\tans = max(tmp + 1, ans)\n\tprint(ans)\n", "from math import factorial\nfrom collections import Counter, defaultdict\nfrom heapq import heapify, heappop, heappush\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef N():\n\treturn int(input())\n\ndef comb(n, m):\n\treturn factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0\n\ndef perm(n, m):\n\treturn factorial(n) // factorial(n - m) if n >= m else 0\n\ndef mdis(x1, y1, x2, y2):\n\treturn abs(x1 - x2) + abs(y1 - y2)\nmod = 1000000007\nINF = float('inf')\n\ndef main():\n\tfor _ in range(N()):\n\t\tarr = list(input())\n\t\trec = [0]\n\t\tres = 0\n\t\tfor (i, v) in enumerate(arr):\n\t\t\tif v == 'R':\n\t\t\t\tres = max(i + 1 - rec[-1], res)\n\t\t\t\trec.append(i + 1)\n\t\tres = max(res, len(arr) + 1 - rec[-1])\n\t\tprint(res)\nmain()\n", "import math\nfrom decimal import *\nfor _ in range(int(input())):\n\ts = str(input())\n\ts = '0' + s\n\tans = 0\n\t(p1, p2) = (0, len(s))\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tp2 = int(i)\n\t\t\tans = max(ans, p2 - p1)\n\t\t\tp1 = int(i)\n\tif ans == 0:\n\t\tans = len(s)\n\telse:\n\t\tans = max(len(s) - p1, ans)\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = input().strip()\n\ta = [0] + [i + 1 for i in range(len(s)) if s[i] == 'R'] + [len(s) + 1]\n\tb = [a[i] - a[i - 1] for i in range(1, len(a))]\n\tprint(max(b))\n", "import math\n\ndef solve():\n\tdata = [char for char in input()]\n\td = 1\n\ttile = len(data) - 1\n\tcount = 1\n\twhile tile >= 0:\n\t\tif data[tile] == 'L':\n\t\t\ttile -= 1\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > d:\n\t\t\t\td = count\n\t\t\ttile -= 1\n\t\t\tcount = 1\n\tif count > d:\n\t\td = count\n\tprint(d)\nt = int(input())\nfor i in range(t):\n\tsolve()\n", "def main():\n\td = int(input())\n\tfor i in range(d):\n\t\ts = input()\n\t\tl = 0\n\t\tres = []\n\t\tfor (i, v) in enumerate(s):\n\t\t\tif v == 'R':\n\t\t\t\tres.append(i + 1 - l)\n\t\t\t\tl = i + 1\n\t\tres.append(len(s) + 1 - l)\n\t\tprint(max(res) if res else len(s) + 1)\nmain()\n", "for _ in range(int(input())):\n\tw = input()\n\tn = len(w)\n\tif 'R' not in w:\n\t\tprint(n + 1)\n\telse:\n\t\tmp = [0]\n\t\tfor i in range(n):\n\t\t\tif w[i] == 'R':\n\t\t\t\tmp.append(i + 1)\n\t\tmp.append(n + 1)\n\t\tans = []\n\t\taaaa = -10 ** 9\n\t\tfor i in range(len(mp) - 1):\n\t\t\tt = mp[i + 1] - mp[i]\n\t\t\taaaa = max(aaaa, t)\n\t\tprint(aaaa)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tn = len(s)\n\tind = [-1]\n\td = []\n\tco = s.count('R')\n\tif co is 0:\n\t\tprint(n + 1)\n\telse:\n\t\tloc = 0\n\t\tfor j in range(n):\n\t\t\tif s[j] == 'R':\n\t\t\t\tind.append(j)\n\t\tind.append(n)\n\t\tfor j in range(len(ind) - 1):\n\t\t\tdiff = ind[j + 1] - ind[j]\n\t\t\td.append(diff)\n\t\tprint(max(d))\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tans = 0\n\ts = list(input())\n\tis_prev_L = False\n\tcur_L_count = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcur_L_count += 1\n\t\telse:\n\t\t\tif cur_L_count > ans:\n\t\t\t\tans = cur_L_count\n\t\t\tcur_L_count = 0\n\tif cur_L_count > ans:\n\t\tans = cur_L_count\n\tprint(ans + 1)\n", "T = int(input())\nwhile T:\n\ts = input()\n\tloc = -1\n\tm = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - loc > m:\n\t\t\t\tm = i - loc\n\t\t\tloc = i\n\tif loc == -1:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tif len(s) - loc > m:\n\t\t\tm = len(s) - loc\n\t\tprint(m)\n\tT -= 1\n", "def ii():\n\treturn int(input())\n\ndef ai():\n\treturn list(map(int, input().split()))\n\ndef mi():\n\treturn map(int, input().split())\nfor _ in range(ii()):\n\tpath = list(input())\n\tarr = [0 for i in range(len(path) + 1)]\n\tmax_con_seq = 0\n\ttemp = 0\n\tcont = False\n\tfor ele in path:\n\t\tif ele == 'L' and cont:\n\t\t\ttemp += 1\n\t\telif ele == 'R':\n\t\t\tcont = False\n\t\t\tmax_con_seq = max(max_con_seq, temp)\n\t\t\ttemp = 0\n\t\telse:\n\t\t\tcont = True\n\t\t\ttemp += 1\n\tprint(max(max_con_seq, temp) + 1)\n", "for _ in range(int(input())):\n\tl = list(input())\n\td = 0\n\tindex = len(l)\n\tflag = 0\n\tfor i in range(len(l) - 1, -1, -1):\n\t\tif i < index - d:\n\t\t\tif l[i] == 'R':\n\t\t\t\td = index - i\n\t\t\t\tindex = i\n\t\telif l[i] == 'R':\n\t\t\tindex = i\n\tif 0 < index - d + 1:\n\t\td = index - i + 1\n\tprint(d)\n", "from sys import stdin, stdout\nn = int(stdin.readline())\na = []\nfor i in range(n):\n\ta.append(stdin.readline())\nfor k in range(n):\n\tcounter = 0\n\tans = 0\n\tfor j in range(len(a[k])):\n\t\tif a[k][j] == 'L':\n\t\t\tcounter += 1\n\t\telse:\n\t\t\tans = max(ans, counter + 1)\n\t\t\tcounter = 0\n\tprint(ans)\n", "from sys import exit\n\ndef i():\n\treturn input()\n\ndef ii():\n\treturn int(input())\n\ndef iis():\n\treturn map(int, input().split())\n\ndef liis():\n\treturn list(map(int, input().split()))\n\ndef print_array(a):\n\tprint(' '.join(map(str, a)))\nt = ii()\nfor _ in range(t):\n\tbla = []\n\ts = input()\n\tlast = 'R'\n\tcount = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L' and last == s[i]:\n\t\t\tcount += 1\n\t\telif s[i] == 'L':\n\t\t\tcount = 1\n\t\telse:\n\t\t\tbla.append(count)\n\t\t\tcount = 0\n\t\tlast = s[i]\n\tbla.append(count)\n\tprint(max(bla) + 1)\n", "def solve(s):\n\ts = 'R' + s + 'R'\n\tcur = 0\n\tret = -1\n\tfor (i, v) in enumerate(s):\n\t\tif v == 'R':\n\t\t\tret = max(ret, i - cur)\n\t\t\tcur = i\n\treturn ret\n\ndef main():\n\tinp = lambda : [int(x) for x in input().split()]\n\ti = lambda : int(input())\n\ttc = i()\n\tfor _ in range(tc):\n\t\ts = input()\n\t\tprint(solve(s))\nmain()\n", "t = int(input())\nfor i in range(t):\n\tn = input()\n\tif 'R' in n:\n\t\ts = n.split('R')\n\t\tlength = map(len, s)\n\t\tprint(max(*length) + 1)\n\telse:\n\t\tprint(len(n) + 1)\n", "import sys\n\ndef solve():\n\ts = input()\n\tn = len(s)\n\tstr = [s[i] for i in range(n)]\n\tstr.append('R')\n\tmx = 0\n\tprev = -1\n\tfor i in range(n + 1):\n\t\tif str[i] == 'R':\n\t\t\tmx = max(mx, i - prev)\n\t\t\tprev = i\n\treturn mx\nt = int(input())\nwhile t > 0:\n\tprint(solve())\n\tt -= 1\n", "t = int(input())\nresult = []\nfor _ in range(t):\n\ts = 'R' + input() + 'R'\n\tA = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tA.append(i)\n\tB = []\n\tfor i in range(1, len(A)):\n\t\tB.append(A[i] - A[i - 1])\n\tresult.append(str(max(B)))\nprint('\\n'.join(result))\n", "for _ in range(int(input())):\n\ts = input()\n\tm = 0\n\ti = 0\n\tn = len(s)\n\twhile i < n:\n\t\tif s[i] == 'L':\n\t\t\tcounter = 0\n\t\t\twhile i < n and s[i] == 'L':\n\t\t\t\tcounter += 1\n\t\t\t\ti += 1\n\t\t\tif m < counter:\n\t\t\t\tm = counter\n\t\ti += 1\n\tprint(m + 1)\n", "import sys\nget_string = lambda : sys.stdin.readline().strip()\nget_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))\nget_int = lambda : int(sys.stdin.readline())\nfor _ in range(get_int()):\n\ts = 'R' + get_string() + 'R'\n\tmx = 0\n\tcount = 0\n\tIstart = 0\n\tIend = 1\n\twhile Iend < len(s):\n\t\tif s[Iend] == 'R':\n\t\t\tmx = max(mx, count)\n\t\t\tcount = 0\n\t\t\tIstart = Iend\n\t\t\tIend += 1\n\t\telse:\n\t\t\tcount += 1\n\t\t\tIend += 1\n\tprint(mx + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tchamp = []\n\tcnt = 1\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tchamp.append(cnt)\n\t\t\tcnt = 1\n\t\telse:\n\t\t\tcnt += 1\n\tchamp.append(cnt)\n\tprint(max(champ))\n", "def main():\n\top = ''\n\tt = int(input())\n\tfor i in range(t):\n\t\tip = input()\n\t\tj = 0\n\t\tprev_r = 0\n\t\tmax_dist = 0\n\t\tr_cnt = 0\n\t\twhile j < len(ip):\n\t\t\tif ip[j] == 'R':\n\t\t\t\tif r_cnt != 0:\n\t\t\t\t\tmax_dist = max(max_dist, j - prev_r)\n\t\t\t\telse:\n\t\t\t\t\tmax_dist = j + 1\n\t\t\t\t\tr_cnt += 1\n\t\t\t\tprev_r = j\n\t\t\tj += 1\n\t\tif max_dist != 0:\n\t\t\tmax_dist = max(max_dist, len(ip) - prev_r)\n\t\t\top += str(max_dist) + '\\n'\n\t\telse:\n\t\t\top += str(len(ip) + 1) + '\\n'\n\tprint(op)\nmain()\n", "for _ in range(int(input())):\n\ts = input()\n\tmax_len = 0\n\tcnt = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcnt += 1\n\t\telif s[i] == 'R':\n\t\t\tif cnt > max_len:\n\t\t\t\tmax_len = cnt\n\t\t\tcnt = 0\n\tif i == len(s) - 1 and cnt > max_len:\n\t\tmax_len = cnt\n\tprint(max_len + 1)\n", "t = int(input())\nfor z in range(t):\n\ts = input()\n\tlast = -1\n\tjump = 1\n\tflag = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tflag = 1\n\t\t\tif last == -1:\n\t\t\t\tjump = i + 1\n\t\t\telif jump < i - last:\n\t\t\t\tjump = i - last\n\t\t\tlast = i\n\tif flag == 0:\n\t\tprint(len(s) + 1)\n\telif last + jump < len(s):\n\t\tprint(len(s) - last)\n\telse:\n\t\tprint(jump)\n", "t = int(input())\nfor x in range(0, t):\n\ts = input()\n\ts = list(s)\n\tn = len(s)\n\tans = 0\n\tcnt = 0\n\tfor i in range(0, n):\n\t\tif s[i] == 'L':\n\t\t\tcnt = cnt + 1\n\t\telse:\n\t\t\tif ans < cnt:\n\t\t\t\tans = cnt\n\t\t\tcnt = 0\n\tif ans < cnt:\n\t\tans = cnt\n\tprint(ans + 1)\n", "t = int(input())\nfor i in range(t):\n\tIN = input()\n\tcrt = 0\n\tms = 0\n\tfor x in IN:\n\t\tif x == 'L':\n\t\t\tcrt += 1\n\t\telse:\n\t\t\tif crt > ms:\n\t\t\t\tms = crt\n\t\t\tcrt = 0\n\tif crt > ms:\n\t\tms = crt\n\tprint(ms + 1)\n", "import sys\nimport os\nimport math\nimport copy\nfrom math import gcd\nfrom bisect import bisect\nfrom io import BytesIO, IOBase\nfrom math import sqrt, floor, factorial, gcd, log, ceil\nfrom collections import deque, Counter, defaultdict\nfrom itertools import permutations, combinations\nfrom itertools import accumulate\n\ndef Int():\n\treturn int(sys.stdin.readline())\n\ndef Mint():\n\treturn map(int, sys.stdin.readline().split())\n\ndef Lstr():\n\treturn list(sys.stdin.readline().strip())\n\ndef Str():\n\treturn sys.stdin.readline().strip()\n\ndef Mstr():\n\treturn map(str, sys.stdin.readline().strip().split())\n\ndef List():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef Hash():\n\treturn dict()\n\ndef Mod():\n\treturn 1000000007\n\ndef Ncr(n, r, p):\n\treturn fact[n] * (ifact[r] * ifact[n - r] % p) % p\n\ndef Most_frequent(list):\n\treturn max(set(list), key=list.count)\n\ndef Mat2x2(n):\n\treturn [List() for _ in range(n)]\n\ndef Lcm(x, y):\n\treturn x * y // gcd(x, y)\n\ndef dtob(n):\n\treturn bin(n).replace('0b', '')\n\ndef btod(n):\n\treturn int(n, 2)\n\ndef common(l1, l2):\n\treturn set(l1).intersection(l2)\n\ndef solution():\n\tfor _ in range(Int()):\n\t\ts = Str()\n\t\tp = 0\n\t\tc = 0\n\t\tres = []\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tres.append(i + 1)\n\t\tres.insert(0, 0)\n\t\tres.append(len(s) + 1)\n\t\tans = 0\n\t\tfor i in range(len(res) - 1):\n\t\t\tans = max(ans, res[i + 1] - res[i])\n\t\tprint(ans)\nsolution()\n", "for _ in range(int(input())):\n\ts = input()\n\tn = 0\n\tc = 0\n\tf = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L' and f == 0:\n\t\t\tf = 1\n\t\t\tc = 1\n\t\telif s[i] == 'L' and f == 1:\n\t\t\tc += 1\n\t\telse:\n\t\t\tf = 0\n\t\t\tif c > n:\n\t\t\t\tn = c\n\tif c > n:\n\t\tn = c\n\tprint(n + 1)\n", "for _ in range(int(input())):\n\ts = str(input())\n\tcount = 0\n\tm = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tm = max(count, m)\n\t\t\tcount = 0\n\tm = max(count, m)\n\tif m == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(m + 1)\n", "import io, os\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\n\ndef get_str():\n\treturn input().decode().strip()\n\ndef rint():\n\treturn map(int, input().split())\n\ndef oint():\n\treturn int(input())\nt = oint()\nfor _ in range(t):\n\ts = str(get_str())\n\tss = s.replace('R', ' ').split()\n\tmax_len = 0\n\tfor ll in ss:\n\t\tif len(ll) > max_len:\n\t\t\tmax_len = len(ll)\n\tprint(max_len + 1)\n", "for _ in range(int(input())):\n\ts = sorted([len(x) for x in input().split('R')], reverse=True)\n\tprint(s[0] + 1)\n", "t = int(input())\nfor test in range(t):\n\tx = input()\n\ty = list(x)\n\tz = []\n\tfor i in range(len(y)):\n\t\tif y[i] == 'R':\n\t\t\tz.append(i)\n\tif len(z) > 0:\n\t\tif len(z) == 1:\n\t\t\tp = z[0]\n\t\t\tq = len(y) - z[0] - 1\n\t\t\tif p >= q:\n\t\t\t\tmax = p\n\t\t\telse:\n\t\t\t\tmax = q\n\t\t\tprint(max + 1)\n\t\telse:\n\t\t\ta = []\n\t\t\tfor i in range(1, len(z)):\n\t\t\t\ta.append(z[i] - (z[i - 1] + 1))\n\t\t\ta.append(len(y) - z[len(z) - 1] - 1)\n\t\t\ta.append(z[0])\n\t\t\tm = a[0]\n\t\t\tfor i in range(len(a)):\n\t\t\t\tif a[i] > m:\n\t\t\t\t\tm = a[i]\n\t\t\tprint(m + 1)\n\telse:\n\t\tprint(len(y) + 1)\n", "a = int(input())\nr = 0\nf = list()\nwhile r < a:\n\tb = [char for char in input()]\n\tblen = len(b)\n\t(s, m) = (0, 0)\n\t(e, d, c) = (0, 0, 0)\n\twhile s < blen:\n\t\tif b[s] == 'R':\n\t\t\tc = s + 1\n\t\t\te = c - m\n\t\t\tb[s] = 'A'\n\t\t\tif e > d:\n\t\t\t\td = e\n\t\t\tm = c\n\t\ts = s + 1\n\te = blen + 1 - m\n\tif e > d:\n\t\td = e\n\tf.append(d)\n\tr = r + 1\nr = 0\nwhile r < a:\n\tprint(f[r])\n\tr = r + 1\n", "tests = int(input())\nfor _ in range(tests):\n\tm = 0\n\tc = 1\n\ts = 'R' + input() + 'R'\n\tfor d in s:\n\t\tif d == 'R':\n\t\t\tm = max(m, c)\n\t\t\tc = 1\n\t\telse:\n\t\t\tc += 1\n\tprint(m)\n", "import sys\nimport math\nfor _ in range(int(input())):\n\ts = list(input())\n\ts.insert(0, 'R')\n\ts.append('R')\n\tm = -1\n\tprev = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tdist = i - prev\n\t\t\tif dist > m:\n\t\t\t\tm = dist\n\t\t\tprev = i\n\tprint(m)\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\ntest = inp()\nfor k in range(test):\n\ts = insr()\n\tn = len(s)\n\t(left, right) = (0, 0)\n\tmaxL = 0\n\ttemp = 0\n\twhile right < n:\n\t\tif s[right] == 'R':\n\t\t\tmaxL = max(maxL, temp)\n\t\t\tleft = right + 1\n\t\t\ttemp = 0\n\t\telse:\n\t\t\ttemp += 1\n\t\tright += 1\n\tmaxL = max(maxL, temp)\n\tprint(maxL + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tif s.count('L') == 0:\n\t\tprint(1)\n\telif s.count('R') == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tA = []\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tA.append(i)\n\t\tX = []\n\t\tfor i in range(len(A) - 1):\n\t\t\tX.append(A[i + 1] - A[i])\n\t\tif len(X) > 0:\n\t\t\tz = max(X)\n\t\telse:\n\t\t\tz = 0\n\t\tx = s.index('R') + 1\n\t\ts = s[::-1]\n\t\ty = s.index('R') + 1\n\t\tprint(max(max(x, y), z))\n", "t = int(input())\nout = []\nfor i in range(t):\n\tmaxL = 1\n\tcurrentL = 1\n\tseq = input()\n\tfor j in range(len(seq)):\n\t\tc = seq[j]\n\t\tif c == 'L':\n\t\t\tcurrentL += 1\n\t\telse:\n\t\t\tif currentL > maxL:\n\t\t\t\tmaxL = currentL\n\t\t\tcurrentL = 1\n\tout.append(str(max(maxL, currentL)))\nprint('\\n'.join(out))\n", "from sys import stdin\nN = int(stdin.readline().rstrip())\nans = 0\nfor i in range(N):\n\tans = 0\n\tS = 'R' + input() + 'R'\n\tdist = 0\n\tfor i in range(0, len(S)):\n\t\tif S[i] == 'L':\n\t\t\tdist += 1\n\t\telse:\n\t\t\tdist = 0\n\t\tans = max(ans, dist)\n\tprint(ans + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tans = 0\n\ti = 0\n\twhile i < n:\n\t\tj = i\n\t\tif s[j] == 'L':\n\t\t\twhile j < n and s[j] == 'L':\n\t\t\t\tj += 1\n\t\tans = max(ans, j - i)\n\t\tif i == j:\n\t\t\ti += 1\n\t\telse:\n\t\t\ti = j\n\tprint(ans + 1)\n", "for _ in range(int(input())):\n\tn = 'R' + input()\n\tl = []\n\tfor i in range(len(n)):\n\t\tif n[i] == 'R':\n\t\t\tl.append(i)\n\tl.append(len(n))\n\tmax = 0\n\tfor i in range(1, len(l)):\n\t\tif l[i] - l[i - 1] > max:\n\t\t\tmax = l[i] - l[i - 1]\n\tprint(max)\n", "for _ in range(int(input())):\n\ts = input()\n\tif s.count('R') == 0:\n\t\tprint(len(s) + 1)\n\telif s.count('L') == 0:\n\t\tprint('1')\n\telse:\n\t\tcount = 0\n\t\tmaxi = 0\n\t\tfor i in s:\n\t\t\tif i == 'L':\n\t\t\t\tcount += 1\n\t\t\t\tmaxi = max(count, maxi)\n\t\t\telse:\n\t\t\t\tcount = 0\n\t\tprint(maxi + 1)\n", "import sys\nimport math\n\ndef read_line():\n\treturn sys.stdin.readline()[:-1]\n\ndef read_int():\n\treturn int(sys.stdin.readline())\n\ndef read_int_line():\n\treturn [int(v) for v in sys.stdin.readline().split()]\nt = read_int()\nfor i in range(t):\n\ts = read_line()\n\ta = s.split('R')\n\tcnt = 1\n\tif len(a) > 0:\n\t\tfor i in range(len(a)):\n\t\t\tif len(a[i]) >= cnt:\n\t\t\t\tcnt = len(a[i]) + 1\n\tprint(cnt)\n", "t = int(input())\nwhile t != 0:\n\tA = str(input())\n\ti = 0\n\tC = []\n\twhile i < len(A):\n\t\tif A[i] == 'R':\n\t\t\tC.append(i + 1)\n\t\ti += 1\n\tif len(C) == 0:\n\t\tprint(len(A) + 1)\n\telse:\n\t\tD = [C[0]]\n\t\tj = 0\n\t\twhile j != len(C) - 1:\n\t\t\tD.append(C[j + 1] - C[j])\n\t\t\tj += 1\n\t\tD.append(len(A) + 1 - C[j])\n\t\tprint(max(D))\n\tt -= 1\n", "for _ in range(int(input())):\n\tseq = input()\n\td = 0\n\tcnt = 1\n\tfor ch in seq + 'R':\n\t\tif ch == 'R':\n\t\t\td = max(d, cnt)\n\t\t\tcnt = 1\n\t\telse:\n\t\t\tcnt += 1\n\tprint(d)\n", "for _ in [0] * int(input()):\n\ta = [i for (i, x) in enumerate('R' + input() + 'R') if x > 'L']\n\tprint(max((y - x for (x, y) in zip(a, a[1:]))))\n", "for _ in range(int(input())):\n\ts = input()\n\tc = 1\n\tm = 1\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > m:\n\t\t\t\tm = c\n\t\t\tc = 1\n\tif c > m:\n\t\tm = c\n\tprint(m)\n", "from sys import stdin, stdout\nimport math, sys\nfrom itertools import permutations, combinations\nfrom collections import defaultdict\nimport bisect\nimport heapq as hq\n\ndef main():\n\ttry:\n\t\tfor _ in range(int(input())):\n\t\t\tl = ['R']\n\t\t\tl.extend(list(input()))\n\t\t\tl.append('R')\n\t\t\tans = []\n\t\t\tmi = 0\n\t\t\tfor x in range(len(l)):\n\t\t\t\tif l[x] == 'R':\n\t\t\t\t\tans.append(x - mi)\n\t\t\t\t\tmi = x\n\t\t\tprint(max(ans))\n\texcept:\n\t\tpass\nM = 998244353\nP = 1000000007\nmain()\n", "def main():\n\ts = input()\n\ts = 'R' + s + 'R'\n\t(ans, run) = (0, 0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\trun += 1\n\t\telse:\n\t\t\tans = max(ans, run)\n\t\t\trun = 0\n\tprint(ans + 1)\nfor _ in range(int(input())):\n\tmain()\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = input().strip()\n\tflag = False\n\tbiggest = 0\n\tcount = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > biggest:\n\t\t\t\tbiggest = count\n\t\t\tcount = 0\n\tif count > biggest:\n\t\tbiggest = count\n\tprint(biggest + 1)\n", "for _ in range(int(input())):\n\ts = list(input())\n\ts.insert(0, 'R')\n\tmaxr = -1\n\tpre = len(s)\n\tidx = pre - 1\n\twhile idx != -1:\n\t\tif s[idx] == 'R':\n\t\t\tmaxr = max(maxr, pre - idx)\n\t\t\tpre = idx\n\t\tidx -= 1\n\tprint(maxr)\n", "for _ in range(int(input())):\n\ts = input()\n\tif 'R' not in s:\n\t\tprint(len(s) + 1)\n\t\tcontinue\n\tm = 0\n\ti = -1\n\tj = 0\n\twhile j < len(s):\n\t\tif s[j] == 'R':\n\t\t\tif m < j - i:\n\t\t\t\tm = j - i\n\t\t\ti = j\n\t\tj += 1\n\tif j - i > m:\n\t\tm = j - i\n\tprint(m)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tn = len(s)\n\tans = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans.append(i + 1)\n\tif len(ans) == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tfina = []\n\t\tfina.append(ans[0] - 0)\n\t\tfina.append(n + 1 - ans[-1])\n\t\tfor i in range(0, len(ans) - 1):\n\t\t\tfina.append(ans[i + 1] - ans[i])\n\t\tprint(max(fina))\n", "n = int(input())\nfor i in range(n):\n\tx = input()\n\tx += 'R'\n\tans = 1\n\tz = 1\n\tfor y in x:\n\t\tif y == 'L':\n\t\t\tz += 1\n\t\tif y == 'R':\n\t\t\tans = max(z, ans)\n\t\t\tz = 1\n\tprint(ans)\n", "from sys import stdin, stdout\nt = int(stdin.readline())\nwhile t > 0:\n\ts = stdin.readline().split('\\n')[0]\n\tn = len(s)\n\t(low, high) = (1, n + 1)\n\tans = high\n\twhile low <= high:\n\t\tmid = (low + high) // 2\n\t\treach = mid\n\t\tvalid = False\n\t\ti = 0\n\t\twhile i < reach:\n\t\t\tif reach > n:\n\t\t\t\tvalid = True\n\t\t\t\tbreak\n\t\t\tif s[i] == 'R':\n\t\t\t\treach = i + mid + 1\n\t\t\ti += 1\n\t\tif valid:\n\t\t\tans = mid\n\t\t\thigh = mid - 1\n\t\telse:\n\t\t\tlow = mid + 1\n\tstdout.write('{}\\n'.format(ans))\n\tt -= 1\n", "t = int(input())\n\ndef check(m):\n\ti = 0\n\twhile i <= len(s):\n\t\tif s[i] == 'L':\n\t\t\tif i - d[i] <= m:\n\t\t\t\ti = d[i]\n\t\t\telse:\n\t\t\t\treturn False\n\t\telif abs(i - len(s)) <= m:\n\t\t\treturn True\n\t\telif dr.get(i, -1) != -1 and abs(dr[i] - i) <= m:\n\t\t\ti = dr[i]\n\t\telse:\n\t\t\treturn False\n\treturn True\n\ndef bs(s, l, h):\n\tif l <= h:\n\t\tm = (l + h) // 2\n\t\tif check(m):\n\t\t\tif m - 1 > 0 and check(m - 1):\n\t\t\t\treturn bs(s, l, m - 1)\n\t\t\telse:\n\t\t\t\treturn m\n\t\telse:\n\t\t\treturn bs(s, m + 1, h)\nfor t1 in range(t):\n\ts = input()\n\ts = 'R' + s\n\tk = []\n\td = {}\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tk.append(i)\n\t\telif s[i] == 'L':\n\t\t\td[i] = k[-1]\n\tj = []\n\tdr = {}\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tif len(j) > 0:\n\t\t\t\tdr[i] = j[-1]\n\t\t\tj.append(i)\n\tz = bs(s, 1, len(s) + 1)\n\tprint(z)\n", "from math import *\nfrom copy import *\nfrom string import *\nfrom random import *\nfrom sys import stdin\nfrom sys import maxsize\nfrom operator import *\nfrom itertools import *\nfrom collections import Counter\nfrom collections import defaultdict\n\ndef solve(s):\n\tn = len(s)\n\tr = s.count('R')\n\ts = 'R' + s + 'R'\n\tif r == 0:\n\t\treturn n + 1\n\telse:\n\t\tmaxx = 1\n\t\tcurr = 0\n\t\tfor i in range(1, len(s)):\n\t\t\tcurr += 1\n\t\t\tmaxx = max(maxx, curr)\n\t\t\tif s[i] == 'R':\n\t\t\t\tcurr = 0\n\t\treturn maxx\nT = int(input())\nfor _ in range(T):\n\ts = input()\n\tprint(solve(s))\n", "t = int(input())\nfor i in range(t):\n\tli = list(input())\n\td = 0\n\tprev = -1\n\tans = 0\n\tansf = 0\n\twhile d != len(li):\n\t\tif li[d] == 'R':\n\t\t\tans = d - prev\n\t\t\tprev = d\n\t\t\tif ans > ansf:\n\t\t\t\tansf = ans\n\t\tif d == len(li) - 1:\n\t\t\tans = d - prev + 1\n\t\t\tif ans > ansf:\n\t\t\t\tansf = ans\n\t\td = d + 1\n\tprint(ansf)\n", "from sys import stdin, stdout\n\ndef solver(s, d):\n\tn = len(s)\n\trbl = [False for i in range(n + 1)]\n\trbl[0] = True\n\tfor i in range(n):\n\t\tif rbl[i] == False:\n\t\t\tbreak\n\t\tif s[i] == 'R':\n\t\t\tfor j in range(i, min(n + 1, i + d + 1)):\n\t\t\t\trbl[j] = True\n\t\tif s[i] == 'L':\n\t\t\tfor j in range(max(0, i - d), i):\n\t\t\t\trbl[j] = True\n\tif rbl[n] == True:\n\t\treturn True\n\telse:\n\t\treturn False\nt = int(input())\nfor i in range(t):\n\ts = input()\n\ts = 'R' + s\n\tarr = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tarr.append(i)\n\tarr.append(len(s))\n\tans = 1\n\tfor i in range(len(arr) - 1):\n\t\tans = max(ans, arr[i + 1] - arr[i])\n\tprint(ans)\n", "import sys\nfrom math import ceil, sqrt\nread = sys.stdin.buffer.readline\nmi = lambda : map(int, read().split())\nli = lambda : list(mi())\ncin = lambda : int(read())\n\ndef isp(n):\n\ti = 2\n\twhile i * i <= n:\n\t\tif n % i == 0:\n\t\t\treturn False\n\t\ti += 1\n\treturn True\nprimes = []\nfor _ in range(cin()):\n\ts = input()\n\tct = 0\n\tmx = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tct += 1\n\t\telse:\n\t\t\tmx = max(mx, ct)\n\t\t\tct = 0\n\tmx = max(mx, ct)\n\tprint(mx + 1)\n", "t = int(input())\nwhile t != 0:\n\ts = input()\n\tright = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tright.append(i + 1)\n\tright.append(len(s) + 1)\n\tmaxi = 0\n\tfor i in range(len(right) - 1):\n\t\tmaxi = max(maxi, right[i + 1] - right[i])\n\tprint(maxi)\n\tt -= 1\n", "import sys\nsys.setrecursionlimit(200000000)\ntc = int(input())\n\ndef solve(path: str, min_jmp):\n\trightmost_r = path[::-1].find('R')\n\tif rightmost_r == -1:\n\t\treturn max(min_jmp, len(path) + 1)\n\telse:\n\t\tpos = len(path) - rightmost_r - 1\n\t\tjmp = rightmost_r + 1\n\t\treturn solve(path[:pos], max(min_jmp, jmp))\n\ndef solve_non_recursive(path: str):\n\tr_list = [i + 1 for (i, _) in enumerate(path) if _ == 'R']\n\tr_list.insert(0, 0)\n\tr_list.append(len(path) + 1)\n\tmin_jmp = 0\n\tfor i in range(len(r_list) - 1):\n\t\tmin_jmp = max(r_list[i + 1] - r_list[i], min_jmp)\n\treturn min_jmp\nfor _ in range(tc):\n\tpath = input()\n\tprint(solve_non_recursive(path))\n", "t = int(input())\nfor i in range(t):\n\tpath = input()\n\tmaxrep = 0\n\trep = 0\n\tfor i in path:\n\t\tif i == 'L':\n\t\t\trep += 1\n\t\telse:\n\t\t\tif rep > maxrep:\n\t\t\t\tmaxrep = rep\n\t\t\trep = 0\n\tif rep > maxrep:\n\t\tmaxrep = rep\n\tprint(maxrep + 1)\n", "for _ in range(int(input())):\n\tjumps = input()\n\tn = len(jumps)\n\tif not 'R' in jumps:\n\t\tprint(n + 1)\n\t\tcontinue\n\tstep = 0\n\tnow = 0\n\tfor i in range(n):\n\t\tif jumps[i] == 'R':\n\t\t\tstep = max(step, i + 1 - now)\n\t\t\tnow = i + 1\n\tprint(max(step, n + 1 - now))\n", "c = int(input())\nfor _ in range(0, c):\n\tinp = list(input())\n\tmaxl = 0\n\tcandidate = 0\n\tfor k in inp:\n\t\tif k == 'L':\n\t\t\tcandidate += 1\n\t\telif k == 'R':\n\t\t\tif candidate > maxl:\n\t\t\t\tmaxl = candidate\n\t\t\tcandidate = 0\n\tif candidate > maxl:\n\t\tmaxl = candidate\n\tprint(maxl + 1)\n", "t = int(input().strip())\nfrom collections import defaultdict\nimport bisect\nfor _ in range(t):\n\ts = input().strip()\n\tans = 1\n\ttemp = 1\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\ttemp = 1\n\t\telse:\n\t\t\ttemp += 1\n\t\tif temp > ans:\n\t\t\tans = temp\n\tprint(ans)\n", "T = int(input())\nfor _ in range(T):\n\tseq = 'S' + str(input()) + 'F'\n\t(longest, c) = (0, 0)\n\tfor i in seq:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif longest < c:\n\t\t\t\tlongest = c\n\t\t\tc = 0\n\tprint(longest + 1)\n", "n = input()\np = []\nfor i in range(0, int(n)):\n\tl = input()\n\tp.append(l)\nfor i in range(0, len(p)):\n\tk = [0]\n\tv = []\n\tc = p[i]\n\tif 'R' not in c:\n\t\tprint(len(c) + 1)\n\telif c.count('R') == len(c):\n\t\tprint(1)\n\telse:\n\t\tfor j in range(0, len(c)):\n\t\t\tif c[j] == 'R':\n\t\t\t\tv.append(j + 1 - k[-1])\n\t\t\t\tk.append(j + 1)\n\t\tv.append(len(c) + 1 - k[-1])\n\t\tprint(max(v))\n", "import sys\nfor i in range(int(input())):\n\ts = input()\n\tlast = 0\n\tfirst = sys.maxsize\n\tm = -sys.maxsize\n\tn = len(s)\n\tif s == 'L' * n:\n\t\tprint(n + 1)\n\telif s == 'R' * n:\n\t\tprint(1)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tfirst = min(i, first)\n\t\t\t\tm = max(m, i - last)\n\t\t\t\tlast = i\n\t\tprint(max(first + 1, m, n - last))\n", "def main():\n\n\tdef is_ok(mid, S):\n\t\tflag = True\n\t\tfrom collections import Counter\n\t\tcur = Counter(S[:mid])\n\t\tfor i in range(len(S) - mid + 1):\n\t\t\tif mid <= cur['L']:\n\t\t\t\tflag = False\n\t\t\t\tbreak\n\t\t\tcur[S[i]] -= 1\n\t\t\tif i + mid < len(S):\n\t\t\t\tcur[S[i + mid]] += 1\n\t\tif flag:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False\n\n\tdef binary_search_meguru(S):\n\t\tng = 0\n\t\tok = len(S) + 2\n\t\twhile abs(ok - ng) > 1:\n\t\t\tmid = ng + (ok - ng) // 2\n\t\t\tif is_ok(mid, S):\n\t\t\t\tok = mid\n\t\t\telse:\n\t\t\t\tng = mid\n\t\treturn ok\n\tQ = int(input())\n\tfor query in range(Q):\n\t\tS = input()\n\t\tprint(binary_search_meguru(S))\nmain()\n", "t = int(input())\nfor z in range(t):\n\td = input()\n\tstart = -1\n\tm = 0\n\tfor j in range(len(d)):\n\t\tif d[j] == 'R':\n\t\t\tm = max(m, j - start)\n\t\t\tstart = j\n\tm = max(m, len(d) - start)\n\tprint(m)\n", "for _ in range(int(input())):\n\ti = input().split('R')\n\td = 1\n\tfor sub in i:\n\t\tl = len(sub)\n\t\tif l >= d:\n\t\t\td = l + 1\n\tprint(d)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tL = [0]\n\tfor x in range(n):\n\t\tif s[x] == 'R':\n\t\t\tL.append(0)\n\t\telse:\n\t\t\tL[-1] += 1\n\tprint(max(L) + 1)\n", "import math\nt = int(input())\nwhile t > 0:\n\tt -= 1\n\ts = input()\n\tmaxx = 0\n\tcnt = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcnt += 1\n\t\t\tif cnt > maxx:\n\t\t\t\tmaxx = cnt\n\t\telse:\n\t\t\tcnt = 0\n\tprint(maxx + 1)\n", "t = int(input())\nz = 0\nwhile z < t:\n\ta = str(input())\n\tb = 1\n\ttb = 1\n\ty = 1\n\tl = 0\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\tl += 1\n\tif l == 0:\n\t\tprint('1')\n\telse:\n\t\twhile y < len(a):\n\t\t\tif a[y] == a[y - 1] and a[y] == 'L':\n\t\t\t\ttb += 1\n\t\t\telse:\n\t\t\t\tif tb > b:\n\t\t\t\t\tb = tb\n\t\t\t\ttb = 1\n\t\t\ty += 1\n\t\tprint(max(tb, b) + 1)\n\tz += 1\n", "import sys\nfrom collections import defaultdict\nt = int(sys.stdin.readline())\nfor _ in range(t):\n\ts = sys.stdin.readline()[:-1]\n\tn = len(s)\n\tcount = 0\n\td = 0\n\tfor i in range(n):\n\t\td = max(d, count)\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tcount = 0\n\td = max(d, count)\n\tprint(d + 1)\n", "import bisect, collections\n\ndef reachable(d, s):\n\tneed = 0\n\tfor i in range(len(s) - 1, -2, -1):\n\t\tneed += 1\n\t\tif need > d:\n\t\t\treturn False\n\t\tif i >= 0 and s[i] == 'R':\n\t\t\tneed = 0\n\treturn True\n\ndef solution(T):\n\ts = input().strip()\n\t(l, r) = (0, len(s) + 1)\n\tres = r\n\twhile l <= r:\n\t\tmid = (l + r) // 2\n\t\tif reachable(mid, s):\n\t\t\tres = min(res, mid)\n\t\t\tr = mid - 1\n\t\telse:\n\t\t\tl = mid + 1\n\tprint(res)\n\ndef main():\n\tT = int(input().strip())\n\tfor _ in range(T):\n\t\tsolution(T)\nmain()\n", "for _ in range(int(input())):\n\ts = 'R' + input() + 'R'\n\t(ans, j) = (0, 0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - j > ans:\n\t\t\t\tans = i - j\n\t\t\tj = i\n\tprint(ans)\n", "import sys\nt = int(input())\nfor _ in range(t):\n\ta = 'R'\n\ta += input() + 'R'\n\tl = 0\n\tr = 1\n\tans = 0\n\twhile r < len(a):\n\t\tif a[r] == 'R':\n\t\t\tans = max(ans, r - l)\n\t\t\tl = r\n\t\t\tr += 1\n\t\telse:\n\t\t\tr += 1\n\tprint(ans)\n", "q = int(input())\nfor i in range(q):\n\ts = list(input()) + ['R']\n\tans = 0\n\tcur = 0\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tcur += 1\n\t\telse:\n\t\t\tif ans < cur:\n\t\t\t\tans = cur\n\t\t\tcur = 0\n\tprint(ans + 1)\n", "def jumpy_frog(string):\n\tn = len(string)\n\tmin_jump = [0] * (n + 2)\n\tindex = n + 1\n\tfor i in range(n - 1, -1, -1):\n\t\tif string[i] == 'R':\n\t\t\tmin_jump[index] = index - (i + 1)\n\t\t\tindex = i + 1\n\tmin_jump[index] = index\n\treturn max(min_jump)\nn = int(input())\nfor i in range(n):\n\tprint(jumpy_frog(input()))\n", "def main():\n\tt = int(input())\n\tfor i in range(0, t):\n\t\tsolve()\n\ndef solve():\n\ts = input()\n\t(maior, atual) = (0, 0)\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tatual += 1\n\t\telse:\n\t\t\tmaior = max(maior, atual)\n\t\t\tatual = 0\n\tprint(max(maior, atual) + 1)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\ta = input()\n\ta += 'R'\n\tdiff = []\n\tpi = -1\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\ttemp = i - pi\n\t\t\tpi = i\n\t\t\tdiff.append(temp)\n\tprint(max(diff))\n", "def compute(string):\n\tn = len(string)\n\tstack = []\n\tstart = -1\n\tmin_d = 0\n\tfor i in range(n):\n\t\tif string[i] == 'R':\n\t\t\tstack.append(i)\n\t\t\tmin_d = max(min_d, stack[-1] - start)\n\t\t\tstart = stack[-1]\n\tif stack:\n\t\tmin_d = max(min_d, n - stack[-1])\n\telse:\n\t\tmin_d = n + 1\n\treturn min_d\nt = int(input())\nfor _ in range(t):\n\tstring = str(input())\n\tprint(compute(string))\n", "T = int(input())\nfor _ in range(T):\n\tn = input()\n\tn = n + 'R'\n\tv = 0\n\tj = -1\n\tfor i in range(len(n)):\n\t\tif n[i] == 'R':\n\t\t\tv = max(v, i - j)\n\t\t\tj = i\n\tprint(v)\n", "def fun(s):\n\tn = len(s)\n\tprev = -1\n\tlast = n\n\td = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td = max(d, i - prev)\n\t\t\tprev = i\n\treturn max(d, last - prev)\nt = int(input())\nwhile t:\n\ts = input()\n\tprint(fun(s))\n\tt -= 1\n", "for i in range(int(input())):\n\ts = input()\n\ta = []\n\ta.append(-1)\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\ta.append(j)\n\ta.append(len(s))\n\tprint(max([y - x for (x, y) in zip(a[:-1], a[1:])]))\n", "ii = int(input())\nfor kk in range(ii):\n\ta = list(input())\n\tk = 0\n\tmaxi = 0\n\tfor i in range(1, len(a)):\n\t\tif a[i] == 'L' and a[i - 1] == 'L':\n\t\t\tk += 1\n\t\telse:\n\t\t\tk = 0\n\t\tif k > maxi:\n\t\t\tmaxi = k\n\tif maxi == 0 and 'L' in a:\n\t\tprint(2)\n\telif maxi == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(maxi + 2)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tif len(s) == 1:\n\t\tif s[0] == 'R':\n\t\t\tprint(1)\n\t\t\tcontinue\n\t\telse:\n\t\t\tprint(2)\n\t\t\tcontinue\n\tjump = old = -1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tjump = max(j - old, jump)\n\t\t\told = j\n\tprint(max(jump, len(s) - old))\n", "for _ in range(int(input())):\n\tstring = input()\n\tl = list(string)\n\tif not 'R' in l:\n\t\tprint(len(string) + 1)\n\telse:\n\t\tlst = [0]\n\t\tfor i in range(0, len(string)):\n\t\t\tif string[i] == 'R':\n\t\t\t\tlst.append(i + 1)\n\t\tlst.append(len(string) + 1)\n\t\tans = 0\n\t\tfor i in range(len(lst) - 1):\n\t\t\tans = max(ans, lst[i + 1] - lst[i])\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\ts = '#' + input().rstrip()\n\tn = len(s)\n\tif s.count('R') == 0:\n\t\tprint(n)\n\t\tcontinue\n\t(last, now) = (0, 0)\n\trast = -1\n\tfor i in range(1, n):\n\t\tif s[i] == 'R':\n\t\t\tlast = now\n\t\t\tnow = i\n\t\t\trast = max(rast, now - last)\n\tif s[-1] != 'R':\n\t\trast = max(rast, n - now)\n\tprint(rast)\n", "t = int(input())\nans = []\nfor _ in range(t):\n\ts = list(input())\n\tcount = 0\n\tmax = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > max:\n\t\t\t\tmax = count\n\t\t\tcount = 0\n\tif count > max:\n\t\tmax = count\n\tans.append(str(max + 1))\nprint('\\n'.join(ans))\n", "for i in range(int(input())):\n\tq = input()\n\te = []\n\tif 'R' in list(q):\n\t\tw = q.split('R')\n\t\tfor i in w:\n\t\t\te.append(len(i))\n\t\tprint(max(e) + 1)\n\telse:\n\t\tprint(len(q) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tx = 0\n\tm = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tx += 1\n\t\telse:\n\t\t\tm = max(x, m)\n\t\t\tx = 0\n\tm = max(m, x)\n\tprint(m + 1)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\ts = ' ' + s\n\tlens = len(s)\n\tloc = [0]\n\tif 'R' in s:\n\t\tloc = [0] + [j for (j, k) in enumerate(s) if k == 'R']\n\tloc.append(lens)\n\tloc_diff = [0] * len(loc)\n\tfor j in range(len(loc) - 1):\n\t\tloc_diff[j] = loc[j + 1] - loc[j]\n\tprint(max(loc_diff))\n", "t = int(input())\nfor i in range(t):\n\tcase = input()\n\tend = len(case) + 1\n\tcount = 1\n\tbig = 1\n\tfor i in range(len(case)):\n\t\tif case[i] == 'L':\n\t\t\tcount += 1\n\t\t\tif count > big:\n\t\t\t\tbig = count\n\t\telse:\n\t\t\tcount = 1\n\tprint(big)\n", "for _ in range(int(input())):\n\ta = input()\n\tk = a.split('R')\n\tlis = []\n\tfor i in k:\n\t\tlis.append(len(i))\n\tprint(max(lis) + 1)\n", "T = int(input())\nfor _ in range(T):\n\ts = 'R' + input() + 'R'\n\t(lf, mx) = (0, 1)\n\tfor (i, ch) in enumerate(s):\n\t\tif ch == 'R':\n\t\t\tmx = max(mx, i - lf)\n\t\t\tlf = i\n\tprint(mx)\n", "def test(s, d):\n\tn = len(s)\n\tidx = 0\n\ts = 'R' + s + 'R'\n\twhile True:\n\t\tif idx == n + 1:\n\t\t\treturn True\n\t\tunchanged = True\n\t\tst = min(idx + d, n + 1)\n\t\tfor i in range(st, idx, -1):\n\t\t\tif s[i] == 'R':\n\t\t\t\tidx = i\n\t\t\t\tunchanged = False\n\t\t\t\tbreak\n\t\tif unchanged:\n\t\t\treturn False\n\treturn None\nt = int(input())\nfor dum in range(t):\n\ts = input()\n\tn = len(s)\n\tp = n + 1\n\ta = n\n\twhile a >= 1:\n\t\twhile p - a > 0 and test(s, p - a):\n\t\t\tp = p - a\n\t\ta = a // 2\n\tprint(p)\n", "def r(t=int):\n\treturn list(map(t, input().split()))\n\ndef ri(t=int):\n\treturn t(input())\n\ndef cd(it):\n\tret_val = dict()\n\tfor v in it:\n\t\tret_val[v] = ret_val.get(v, 0) + 1\n\treturn ret_val\nfor _ in range(ri()):\n\ta = input()\n\tm = 0\n\ts = 0\n\tfor ai in a:\n\t\tif ai == 'L':\n\t\t\ts += 1\n\t\telse:\n\t\t\tm = max(s, m)\n\t\t\ts = 0\n\tm = max(s, m)\n\tprint(m + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tmx = 0\n\tfor a in s.split('R'):\n\t\tmx = max(mx, len(a))\n\tprint(mx + 1)\n", "from heapq import heappush, heappop, heapify\nfrom collections import deque, defaultdict, Counter\nfrom itertools import permutations, combinations, groupby\nimport functools\nimport sys\nimport bisect\nimport string\nimport math\nimport time\nimport random\n\ndef Golf():\n\t(*a,) = map(int, open(0))\n\ndef I():\n\treturn int(input())\n\ndef S_():\n\treturn input()\n\ndef IS():\n\treturn input().split()\n\ndef LS():\n\treturn [i for i in input().split()]\n\ndef LI():\n\treturn [int(i) for i in input().split()]\n\ndef LI_():\n\treturn [int(i) - 1 for i in input().split()]\n\ndef NI(n):\n\treturn [int(input()) for i in range(n)]\n\ndef NI_(n):\n\treturn [int(input()) - 1 for i in range(n)]\n\ndef StoLI():\n\treturn [ord(i) - 97 for i in input()]\n\ndef ItoS(n):\n\treturn chr(n + 97)\n\ndef LtoS(ls):\n\treturn ''.join([chr(i + 97) for i in ls])\n\ndef GI(V, E, Directed=False, index=0):\n\torg_inp = []\n\tg = [[] for i in range(n)]\n\tfor i in range(E):\n\t\tinp = LI()\n\t\torg_inp.append(inp)\n\t\tif index == 0:\n\t\t\tinp[0] -= 1\n\t\t\tinp[1] -= 1\n\t\tif len(inp) == 2:\n\t\t\t(a, b) = inp\n\t\t\tg[a].append(b)\n\t\t\tif not Directed:\n\t\t\t\tg[b].append(a)\n\t\telif len(inp) == 3:\n\t\t\t(a, b, c) = inp\n\t\t\taa = (inp[0], inp[2])\n\t\t\tbb = (inp[1], inp[2])\n\t\t\tg[a].append(bb)\n\t\t\tif not Directed:\n\t\t\t\tg[b].append(aa)\n\treturn (g, org_inp)\n\ndef GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}):\n\tmp = [1] * (w + 2)\n\tfound = {}\n\tfor i in range(h):\n\t\ts = input()\n\t\tfor char in search:\n\t\t\tif char in s:\n\t\t\t\tfound[char] = (i + 1) * (w + 2) + s.index(char) + 1\n\t\t\t\tmp_def[char] = mp_def[replacement_of_found]\n\t\tmp += [1] + [mp_def[j] for j in s] + [1]\n\tmp += [1] * (w + 2)\n\treturn (h + 2, w + 2, mp, found)\n\ndef TI(n):\n\treturn GI(n, n - 1)\n\ndef bit_combination(k, n=2):\n\trt = []\n\tfor tb in range(n ** k):\n\t\ts = [tb // n ** bt % n for bt in range(k)]\n\t\trt += [s]\n\treturn rt\n\ndef show(*inp, end='\\n'):\n\tif show_flg:\n\t\tprint(*inp, end=end)\nYN = ['YES', 'NO']\nYn = ['Yes', 'No']\nmo = 10 ** 9 + 7\ninf = float('inf')\nl_alp = string.ascii_lowercase\ninput = lambda : sys.stdin.readline().rstrip()\n\ndef ran_input():\n\tn = random.randint(4, 16)\n\t(rmin, rmax) = (1, 10)\n\ta = [random.randint(rmin, rmax) for _ in range(n)]\n\treturn (n, a)\nshow_flg = False\nshow_flg = True\nt = I()\nfor _ in range(t):\n\ts = input() + 'R'\n\tans = 1\n\tc = 1\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tans = max(ans, c)\n\t\t\tc = 1\n\tprint(ans)\n", "import sys\nimport os\nimport time\nimport collections\nfrom collections import Counter, deque\nimport itertools\nimport math\nimport timeit\nimport random\nimport string\n\ndef sieve(n):\n\tif n < 2:\n\t\treturn list()\n\tprime = [True for _ in range(n + 1)]\n\tp = 3\n\twhile p * p <= n:\n\t\tif prime[p]:\n\t\t\tfor i in range(p * 2, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 2\n\tr = [2]\n\tfor p in range(3, n + 1, 2):\n\t\tif prime[p]:\n\t\t\tr.append(p)\n\treturn r\n\ndef divs(n, start=1):\n\tdivisors = []\n\tfor i in range(start, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n / i == i:\n\t\t\t\tdivisors.append(i)\n\t\t\telse:\n\t\t\t\tdivisors.extend([i, n // i])\n\treturn divisors\n\ndef divn(n, primes):\n\tdivs_number = 1\n\tfor i in primes:\n\t\tif n == 1:\n\t\t\treturn divs_number\n\t\tt = 1\n\t\twhile n % i == 0:\n\t\t\tt += 1\n\t\t\tn //= i\n\t\tdivs_number *= t\n\ndef flin(d, x, default=-1):\n\tleft = right = -1\n\tfor i in range(len(d)):\n\t\tif d[i] == x:\n\t\t\tif left == -1:\n\t\t\t\tleft = i\n\t\t\tright = i\n\tif left == -1:\n\t\treturn (default, default)\n\telse:\n\t\treturn (left, right)\n\ndef ceil(n, k):\n\treturn n // k + (n % k != 0)\n\ndef ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef lcm(a, b):\n\treturn abs(a * b) // math.gcd(a, b)\n\ndef prr(a, sep=' '):\n\tprint(sep.join(map(str, a)))\n\ndef dd():\n\treturn collections.defaultdict(int)\n\ndef ddl():\n\treturn collections.defaultdict(list)\nres = []\nfor _ in range(ii()):\n\ts = input()\n\tans = 0\n\tp = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - p)\n\t\t\tp = i\n\tres.append(max(ans, len(s) - p))\nprr(res, '\\n')\n", "t = int(input())\nfor i in range(t):\n\tx = input()\n\tr = []\n\td = []\n\tfor i in range(len(x)):\n\t\tif x[i] == 'R':\n\t\t\tr.append(i)\n\tif r:\n\t\td.append(r[0] + 1)\n\t\tfor i in range(1, len(r)):\n\t\t\td.append(r[i] - r[i - 1])\n\t\td.append(len(x) - r[-1])\n\t\tprint(max(d))\n\telse:\n\t\tprint(len(x) + 1)\n", "for _ in [0] * int(input()):\n\ts = input()\n\tx = 1\n\tarr = []\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tx += 1\n\t\telse:\n\t\t\tif x:\n\t\t\t\tarr.append(x)\n\t\t\tx = 1\n\tif x:\n\t\tarr.append(x)\n\tprint(max(arr))\n", "t = int(input())\nfor i in range(t):\n\tway = list(input())\n\told_r = 0\n\tnew_r = 0\n\tfor elem in way:\n\t\tif elem == 'L':\n\t\t\tnew_r += 1\n\t\telse:\n\t\t\told_r = max(old_r, new_r)\n\t\t\tnew_r = 0\n\told_r = max(old_r, new_r)\n\tprint(old_r + 1)\n", "def testCase():\n\tenv = input()\n\trecord = 0\n\tlCounter = 0\n\tfor node in env:\n\t\tif node == 'L':\n\t\t\tlCounter += 1\n\t\telse:\n\t\t\trecord = max(record, lCounter)\n\t\t\tlCounter = 0\n\trecord = max(record, lCounter)\n\treturn record + 1\nrez = []\nt = int(input())\nfor i in range(t):\n\trez.append(testCase())\nfor r in rez:\n\tprint(r)\n", "t = int(input())\nans = [-1 for i in range(t)]\nfor i in range(t):\n\troad = input()\n\troad += 'R'\n\tl = -1\n\tr = -1\n\tmn = -1\n\tfor j in range(len(road)):\n\t\tif road[j] == 'R':\n\t\t\tif l == -1:\n\t\t\t\tl = j\n\t\t\t\tmn = l + 1\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tr = j\n\t\t\t\tif mn < r - l:\n\t\t\t\t\tmn = r - l\n\t\t\t\tl = r\n\tans[i] = mn\nfor i in ans:\n\tprint(i)\n", "nCases = int(input())\nfor _ in range(nCases):\n\tjumps = input()\n\tbigJump = 1\n\tcurJump = 1\n\tfor j in jumps:\n\t\tif j == 'L':\n\t\t\tcurJump += 1\n\t\tif j == 'R':\n\t\t\tbigJump = max(bigJump, curJump)\n\t\t\tcurJump = 1\n\tprint(max(bigJump, curJump))\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tmax_n = 1\n\tn = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tn += 1\n\t\telse:\n\t\t\tn = 1\n\t\tif n > max_n:\n\t\t\tmax_n = n\n\tprint(max_n)\n", "from math import *\nmod = 1000000007\ninf = 10000000000000000\n\ndef binpow(a, b):\n\tglobal mod\n\tif b == 1:\n\t\treturn a % mod\n\tu = binpow(a, b // 2)\n\tif b % 2 == 0:\n\t\treturn u * u % mod\n\telse:\n\t\treturn u * u * a % mod\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a % b)\ntemp = [0] * 500\nused = [0] * 500\n\ndef bs(low, high, target):\n\tif low == high:\n\t\treturn low\n\telif low + 1 == high:\n\t\tif temp[high] > target:\n\t\t\treturn low\n\t\telse:\n\t\t\treturn high\n\telse:\n\t\tmid = (low + high) // 2\n\t\tif temp[mid] == target:\n\t\t\treturn mid\n\t\telif temp[mid] > target:\n\t\t\treturn bs(low, mid - 1, target)\n\t\telse:\n\t\t\treturn bs(mid, high, target)\nfor _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tlast = 0\n\tmaxo = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmaxo = max(maxo, i + 1 - last)\n\t\t\tlast = i + 1\n\tmaxo = max(maxo, n + 1 - last)\n\tprint(maxo)\n", "import re\npattern = 'L+'\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tf = re.findall(pattern, s)\n\tif f:\n\t\tprint(len(max(f, key=lambda x: len(x))) + 1)\n\telse:\n\t\tprint(1)\n", "for _ in range(int(input())):\n\tpath = input()\n\tn = len(path)\n\tL = [0] * (n + 2)\n\tcount = 1\n\tres = 1\n\tfor x in path:\n\t\tif x == 'L':\n\t\t\tcount += 1\n\t\t\tres = max(res, count)\n\t\telse:\n\t\t\tcount = 1\n\tprint(res)\n", "n = int(input())\ny = []\nfor i in range(n):\n\tk = []\n\tt = list(input())\n\tu = 0\n\td = 0\n\tX = 0\n\tmaxi1 = 0\n\tmaxi = 0\n\tk.append(0)\n\tfor a in range(len(t)):\n\t\tif t[a] == 'R':\n\t\t\tk.append(a)\n\tk.append(len(t))\n\tfor c in range(len(k) - 1):\n\t\tmaxi1 = k[c + 1] - k[c]\n\t\tif maxi1 > maxi:\n\t\t\tmaxi = maxi1\n\t\t\tx = c\n\tif x == 0:\n\t\ty.append(maxi + 1)\n\telif x == len(k) - 2 and len(k) == 3 and (len(t) == 1):\n\t\ty.append(maxi)\n\telif x == len(k) - 2 and len(k) < 4:\n\t\ty.append(maxi)\n\telse:\n\t\ty.append(maxi)\n\tk.clear()\nfor l in range(n):\n\tprint(y[l])\n", "import math as m\n\ndef f1():\n\tTestcases = int(input())\n\tfor i in range(0, Testcases):\n\t\tColumns = int(input())\n\t\tInAi = [int(j) for j in input().split(' ')]\n\t\tOddf = False\n\t\tEvenf = False\n\t\tfor k in InAi:\n\t\t\tif k % 2 == 0:\n\t\t\t\tEvenf = True\n\t\t\telse:\n\t\t\t\tOddf = True\n\t\t\tif Oddf == True and Evenf == True:\n\t\t\t\tprint('NO')\n\t\t\t\tbreak\n\t\tif Oddf == False or Evenf == False:\n\t\t\tprint('YES')\n\ndef f2():\n\tTestcases = int(input())\n\tfor i in range(0, Testcases):\n\t\tN = int(input())\n\t\tArray = [int(j) for j in input().split(' ')]\n\t\tdict1 = dict()\n\t\tflag = False\n\t\tfor k in range(0, len(Array)):\n\t\t\tif Array[k] in dict1:\n\t\t\t\tif k - dict1[Array[k]][0] >= 2:\n\t\t\t\t\tflag = True\n\t\t\t\t\tprint('YES')\n\t\t\t\t\tbreak\n\t\t\t\tdict1[Array[k]].append(k)\n\t\t\telse:\n\t\t\t\tdict1[Array[k]] = list()\n\t\t\t\tdict1[Array[k]].append(k)\n\t\tif flag == False:\n\t\t\tprint('NO')\n\ndef f3():\n\tTestcases = int(input())\n\tfor i in range(0, Testcases):\n\t\tString = str(input())\n\t\tListR = list()\n\t\tfor j in range(0, len(String)):\n\t\t\tif String[j] == 'R':\n\t\t\t\tListR.append(j + 1)\n\t\tMinR = 0\n\t\tif len(ListR) == 0:\n\t\t\tMinR = len(String) + 1\n\t\t\tprint(MinR)\n\t\t\tcontinue\n\t\telse:\n\t\t\tMinR = ListR[0]\n\t\tfor k in range(1, len(ListR)):\n\t\t\tdist = ListR[k] - ListR[k - 1]\n\t\t\tif dist > MinR:\n\t\t\t\tMinR = dist\n\t\tif len(String) + 1 - ListR[-1] > MinR:\n\t\t\tMinR = len(String) + 1 - ListR[-1]\n\t\tprint(MinR)\nf3()\n", "t = int(input())\nfor x in range(t):\n\ts = input()\n\trr = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\trr.append(i + 1)\n\trr.append(len(s) + 1)\n\tmm = -1\n\tfor i in range(1, len(rr)):\n\t\tif rr[i] - rr[i - 1] > mm:\n\t\t\tmm = rr[i] - rr[i - 1]\n\tprint(mm)\n", "import sys\n\ndef solve():\n\tinput = sys.stdin.readline\n\tT = int(input())\n\tfor _ in range(T):\n\t\tS = input().strip('\\n')\n\t\tS += 'R'\n\t\tmaxL = 0\n\t\tstart = False\n\t\tcount = 0\n\t\tfor i in range(len(S)):\n\t\t\tif S[i] == 'L':\n\t\t\t\tif start:\n\t\t\t\t\tcount += 1\n\t\t\t\telse:\n\t\t\t\t\tcount = 1\n\t\t\t\t\tstart = True\n\t\t\telif start:\n\t\t\t\tmaxL = max(maxL, count)\n\t\t\t\tstart = False\n\t\t\t\tcount = 0\n\t\tprint(maxL + 1)\n\treturn 0\nsolve()\n", "t = int(input())\nfor z in range(t):\n\ta = input()\n\tn = len(a)\n\tl = []\n\tl.append(0)\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(n + 1)\n\ts = []\n\tfor i in range(1, len(l)):\n\t\ts.append(l[i] - l[i - 1])\n\ts.sort()\n\tprint(s[len(s) - 1])\n", "t = int(input())\nfor x in range(t):\n\ts = input()\n\tmax_interval = 1\n\tcount = 1\n\ti = 0\n\twhile i < len(s):\n\t\tif s[i] != 'R':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > max_interval:\n\t\t\t\tmax_interval = count\n\t\t\tcount = 1\n\t\ti += 1\n\tif count > max_interval:\n\t\tmax_interval = count\n\tprint(max_interval)\n", "for _ in range(int(input())):\n\ts = input()\n\tr = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(len(s) + 1)\n\tans = 0\n\tfor i in range(len(r) - 1):\n\t\tif ans < r[i + 1] - r[i]:\n\t\t\tans = r[i + 1] - r[i]\n\tprint(ans)\n", "t = int(input())\nfor test in range(t):\n\tseq = input()\n\tif 'R' in seq:\n\t\tmaxi = max(seq.find('R') + 1, len(seq) - seq.rfind('R'))\n\t\tstart = 0\n\t\tfor i in range(len(seq)):\n\t\t\tif seq[i] == 'R':\n\t\t\t\tif i - start >= maxi:\n\t\t\t\t\tmaxi = i - start\n\t\t\t\tstart = i\n\t\tprint(maxi)\n\telse:\n\t\tprint(len(seq) + 1)\n", "t = int(input())\nfor g in range(0, t):\n\ttemp = input()\n\ttemp += 'R'\n\ts = 'R' + temp\n\ta = []\n\tans = []\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\ta.append(i)\n\tfor i in range(0, len(a) - 1):\n\t\tans.append(a[i + 1] - a[i])\n\tprint(max(ans))\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = input().rstrip() + '#'\n\tmax_l = 0\n\tseq_l = 0\n\tfor ch in s:\n\t\tif ch == 'L':\n\t\t\tseq_l += 1\n\t\telse:\n\t\t\tmax_l = max(max_l, seq_l)\n\t\t\tseq_l = 0\n\tprint(max_l + 1)\n", "t = int(input())\nwhile t > 0:\n\tt = t - 1\n\ts = input()\n\ta = []\n\ta.append(0)\n\tfor i in s:\n\t\ta.append(i)\n\td = []\n\td.append(0)\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\td.append(i)\n\td.append(len(s) + 1)\n\tdiff = []\n\tfor i in range(len(d) - 1):\n\t\tdiff.append(d[i + 1] - d[i])\n\tif len(diff) == 0:\n\t\tdiff.append(len(s) + 2)\n\tprint(min(max(diff), len(s) + 1))\n", "t = int(input())\ng = []\nfor iggn in range(0, t):\n\ts = input()\n\tp = []\n\tj = 1\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tj += 1\n\t\tif s[i] == 'R' or (s[i] == 'L' and i == len(s) - 1):\n\t\t\tp.append(j)\n\t\t\tj = 1\n\tg.append(max(p))\nfor i in g:\n\tprint(i)\n", "for i in range(int(input())):\n\ts = input()\n\te = []\n\tr = []\n\tc = 0\n\te.append(0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\te.append(i + 1)\n\te.append(len(s) + 1)\n\tfor i in range(len(e) - 1):\n\t\tr.append(e[i + 1] - e[i])\n\tprint(max(r))\n", "import sys\ninput = sys.stdin.readline\nfor ti in range(int(input().strip())):\n\ts = input().strip()\n\t(prev, m) = (0, 0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max(m, i + 1 - prev)\n\t\t\tprev = i + 1\n\tm = max(m, len(s) + 1 - prev)\n\tprint(m)\n", "import sys\nimport os\nimport time\nimport collections\nfrom collections import Counter, deque\nimport itertools\nimport math\nimport timeit\nimport random\nfrom io import BytesIO, IOBase\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\n\ndef sieve(n):\n\tif n < 2:\n\t\treturn list()\n\tprime = [True for _ in range(n + 1)]\n\tp = 3\n\twhile p * p <= n:\n\t\tif prime[p]:\n\t\t\tfor i in range(p * 2, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 2\n\tr = [2]\n\tfor p in range(3, n + 1, 2):\n\t\tif prime[p]:\n\t\t\tr.append(p)\n\treturn r\n\ndef divs(n, start=1):\n\tdivisors = []\n\tfor i in range(start, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n / i == i:\n\t\t\t\tdivisors.append(i)\n\t\t\telse:\n\t\t\t\tdivisors.extend([i, n // i])\n\treturn divisors\n\ndef divn(n, primes):\n\tdivs_number = 1\n\tfor i in primes:\n\t\tif n == 1:\n\t\t\treturn divs_number\n\t\tt = 1\n\t\twhile n % i == 0:\n\t\t\tt += 1\n\t\t\tn //= i\n\t\tdivs_number *= t\n\ndef flin(d, x, default=-1):\n\tleft = right = -1\n\tfor i in range(len(d)):\n\t\tif d[i] == x:\n\t\t\tif left == -1:\n\t\t\t\tleft = i\n\t\t\tright = i\n\tif left == -1:\n\t\treturn (default, default)\n\telse:\n\t\treturn (left, right)\n\ndef modpow(b, p, m):\n\tres = 1\n\tb = b % m\n\twhile p:\n\t\tif p & 1:\n\t\t\tres = res * b % m\n\t\tb = b * b % m\n\t\tp >>= 1\n\treturn res\n\ndef mod_inv(a, m):\n\treturn modpow(a, m - 2, m)\n\ndef ncr(n, r, m):\n\tres = 1\n\tif r == 0:\n\t\treturn 1\n\tif n - r < r:\n\t\tr = n - r\n\t(p, k) = (1, 1)\n\twhile r:\n\t\tres = res % m * (n % m * mod_inv(r, m) % m) % m\n\t\tn -= 1\n\t\tr -= 1\n\treturn res\n\ndef ncrlis(n, r, m, fact):\n\treturn fact[n] * (mod_inv(fact[r], m) * mod_inv(fact[n - r], m)) % m % m\n\ndef ceil(n, k):\n\treturn n // k + (n % k != 0)\n\ndef ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef lcm(a, b):\n\treturn abs(a * b) // math.gcd(a, b)\n\ndef prr(a, sep=' '):\n\tprint(sep.join(map(str, a)))\n\ndef dd():\n\treturn collections.defaultdict(int)\n\ndef ddl():\n\treturn collections.defaultdict(list)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfor _ in range(ii()):\n\ts = input()\n\ts = '$' + s + '$'\n\td = []\n\td.append(0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td.append(i)\n\td.append(len(s) - 1)\n\tmx = 0\n\tfor i in range(len(d) - 1):\n\t\tmx = max(mx, d[i + 1] - d[i])\n\tprint(mx)\n", "import sys\nfrom collections import *\n\ndef ri():\n\treturn int(input())\n\ndef rl():\n\treturn list(map(int, input().split()))\nt = ri()\nfor _ in range(t):\n\ts = [x for x in input()]\n\ts.append('R')\n\tn = len(s)\n\tans = 0\n\ttemp = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tans = max(ans, temp)\n\t\t\ttemp = 0\n\tprint(ans + 1)\n", "t = int(input())\nfor i in range(t):\n\tleftSeq = list(filter(lambda x: x != '', input().split('R')))\n\tif len(leftSeq) > 0:\n\t\tmaiorL = max(leftSeq)\n\t\tprint(len(maiorL) + 1)\n\telse:\n\t\tprint(1)\n", "import sys\nRI = lambda : [int(x) for x in sys.stdin.readline().split()]\nri = lambda : sys.stdin.readline().strip()\nts = int(ri())\nfor _ in range(ts):\n\tst = ri()\n\tarr = []\n\tfor i in range(len(st)):\n\t\tif st[i] == 'R':\n\t\t\tarr.append(i)\n\tarr = [-1] + arr\n\tarr.append(len(st))\n\tans = -1\n\tfor i in range(len(arr) - 2, -1, -1):\n\t\tans = max(ans, arr[i + 1] - arr[i])\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\ts = str(input())\n\ti = 0\n\tj = 0\n\tma = 0\n\twhile i < len(s):\n\t\tnu = 0\n\t\tj = i\n\t\twhile j < len(s) and s[j] == 'L':\n\t\t\tj += 1\n\t\t\tnu += 1\n\t\tma = max(ma, nu)\n\t\ti = j + 1\n\tprint(ma + 1)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ts = input()\n\tmax = -1\n\tn = len(s)\n\tind = []\n\tind.append(0)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tind.append(i + 1)\n\tind.append(n + 1)\n\tfor i in range(len(ind) - 1):\n\t\tif ind[i + 1] - ind[i] > max:\n\t\t\tmax = ind[i + 1] - ind[i]\n\tprint(max)\n", "for _ in range(int(input())):\n\tprint(len(max(list(input().split('R')))) + 1)\n", "from sys import stdin\n\ndef get_int_input():\n\treturn int(stdin.readline())\n\ndef get_str_input():\n\treturn input()\n\ndef multiple_input():\n\treturn map(int, stdin.readline().split())\n\ndef list_input():\n\treturn list(map(int, stdin.readline().split()))\nt = get_int_input()\nwhile t:\n\tt -= 1\n\ts = get_str_input()\n\tif all((e == 'R' for e in s)):\n\t\tjump = 1\n\telif all((e == 'L' for e in s)):\n\t\tjump = len(s) + 1\n\telse:\n\t\tx = s[::-1].index('R')\n\t\ttemp = 0\n\t\ty = 0\n\t\tfor i in range(len(s) - x):\n\t\t\tif s[i] == 'L':\n\t\t\t\ttemp += 1\n\t\t\telse:\n\t\t\t\ttemp = 0\n\t\t\ty = max(y, temp)\n\t\tjump = max(x + 1, y + 1)\n\tprint(jump)\n", "from sys import stdin\nfrom collections import deque\nfrom math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin\n\ndef ii():\n\treturn int(stdin.readline())\n\ndef fi():\n\treturn float(stdin.readline())\n\ndef mi():\n\treturn map(int, stdin.readline().split())\n\ndef fmi():\n\treturn map(float, stdin.readline().split())\n\ndef li():\n\treturn list(mi())\n\ndef lsi():\n\tx = list(stdin.readline())\n\tx.pop()\n\treturn x\n\ndef si():\n\treturn stdin.readline()\nfor _ in range(ii()):\n\ta = lsi()\n\tc = m = 0\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tm = max(m, c)\n\t\t\tc = 0\n\tm = max(c, m)\n\tprint(m + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tans = 1\n\tmaxi = 1\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\tmaxi = max(maxi, ans)\n\t\t\tans = 1\n\t\telse:\n\t\t\tans += 1\n\tprint(max(maxi, ans))\n", "from pprint import pprint\nqq = int(input())\nimport itertools\n\ndef countstrs(s):\n\treturn [(k, len(list(g))) for (k, g) in itertools.groupby(s)]\nfor _ in range(qq):\n\ts = input()\n\td = countstrs(s)\n\tma = 0\n\tfor k in d:\n\t\tif k[0] == 'L':\n\t\t\tma = max(ma, k[1])\n\tprint(ma + 1)\n", "t = int(input())\nwhile t:\n\ts = str(input())\n\tn = len(s)\n\tdist = 0\n\tans = -1\n\tfor i in range(n):\n\t\tif i < n - 1:\n\t\t\tif s[i] == 'R':\n\t\t\t\tans = max(ans, dist + 1)\n\t\t\t\tdist = 0\n\t\t\telse:\n\t\t\t\tdist += 1\n\t\telif s[i] == 'R':\n\t\t\tans = max(ans, dist + 1)\n\t\t\tdist = 0\n\t\telse:\n\t\t\tdist += 1\n\t\t\tans = max(ans, dist + 1)\n\tprint(ans)\n\tt -= 1\n", "t = int(input())\nfor t_ in range(t):\n\ts = list(input())\n\t(cnt, ans) = (1, 1)\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tcnt += 1\n\t\telif i == 'R':\n\t\t\tans = max(ans, cnt)\n\t\t\tcnt = 1\n\tans = max(ans, cnt)\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ta = input()\n\tright = [0]\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tright.append(i + 1)\n\tright.append(len(a) + 1)\n\t_max = -1\n\tfor i in range(len(right) - 1):\n\t\tif right[i + 1] - right[i] > _max:\n\t\t\t_max = right[i + 1] - right[i]\n\tprint(_max)\n", "def solution(testCase):\n\tmaxRDist = 0\n\tcurrentDist = 0\n\ttestCase += 'R'\n\tfor s in testCase:\n\t\tcurrentDist += 1\n\t\tif s == 'R':\n\t\t\tif currentDist > maxRDist:\n\t\t\t\tmaxRDist = currentDist\n\t\t\tcurrentDist = 0\n\treturn maxRDist\n\ndef main():\n\tt = int(input())\n\ttestCases = []\n\tfor i in range(t):\n\t\ttestCases.append(input())\n\tfor testCase in testCases:\n\t\tprint(solution(testCase))\nmain()\n", "t = int(input())\nfor i in range(t):\n\tst = input()\n\tst = 'R' + st + 'R'\n\tv = [0] * (len(st) + 1)\n\tfor i in range(1, len(st) + 1):\n\t\tif st[i - 1] == 'L':\n\t\t\tv[i] = v[i - 1] + 1\n\tmaxi = -1\n\tfor i in v:\n\t\tmaxi = max(maxi, i)\n\tprint(maxi + 1)\n", "n = int(input())\nfor _ in range(n):\n\ts = str(input())\n\tans = len(max(s.split('R'))) + 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = 'R' + input() + 'R'\n\tm = -1\n\tprev_s = 0\n\tfor (i, v) in enumerate(s):\n\t\tif v == 'R':\n\t\t\tm = max(i - prev_s, m)\n\t\t\tprev_s = i\n\tprint(m)\n", "def sol(s):\n\trs = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif len(rs) == 0 and i != 0:\n\t\t\t\trs.append(0)\n\t\t\trs.append(i + 1)\n\tif not rs:\n\t\treturn len(s) + 1\n\trs.append(len(s) + 1)\n\tanswer = 0\n\tfor i in range(1, len(rs)):\n\t\tanswer = max(answer, rs[i] - rs[i - 1])\n\treturn answer\nfor _ in range(int(input())):\n\tpath = input()\n\tprint(sol(path))\n", "for _ in range(int(input())):\n\tans = 0\n\tn = input()\n\tpos = []\n\tpos.append(0)\n\tfor i in range(0, len(n)):\n\t\tif n[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(len(n) + 1)\n\tfor i in range(0, len(pos) - 1):\n\t\tans = max(ans, pos[i + 1] - pos[i])\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tind = [0]\n\tfor (i, v) in enumerate(s):\n\t\tif v == 'R':\n\t\t\tind.append(i + 1)\n\tif len(ind) == 0:\n\t\tprint(n + 1)\n\t\tcontinue\n\tind.append(n + 1)\n\tdif = []\n\tfor i in range(1, len(ind)):\n\t\tdif.append(ind[i] - ind[i - 1])\n\tprint(max(dif))\n", "for t in range(int(input())):\n\tn = input()\n\tl = len(n)\n\tlast = 0\n\tres = 0\n\tfor i in range(l):\n\t\tif n[i] == 'R':\n\t\t\tres = max(res, i + 1 - last)\n\t\t\tlast = i + 1\n\tres = max(res, l + 1 - last)\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tcount = []\n\ttemp = 1\n\tflag = 0\n\tdp = [0] * n\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\tif s[0] == 'L':\n\t\t\t\tdp[i] = 1\n\t\telif s[i] == 'L':\n\t\t\tdp[i] = dp[i - 1] + 1\n\tm = max(dp)\n\tprint(m + 1)\n", "for t in range(int(input())):\n\tstring = input()\n\tn = len(string)\n\tans = -1\n\tif string.count('R') == 0:\n\t\tprint(len(string) + 1)\n\t\tcontinue\n\tf = -1\n\ts = -1\n\tf_found = False\n\ts_found = False\n\tfor i in range(n):\n\t\tif f_found and string[i] == 'R':\n\t\t\ts_found = True\n\t\t\ts = i\n\t\t\tif s - f > ans:\n\t\t\t\tans = s - f\n\t\t\tf = i\n\t\tif string[i] == 'R':\n\t\t\tf_found = True\n\t\t\tf = i\n\tprint(max(max(string.find('R'), string[::-1].find('R')) + 1, ans))\n", "from sys import stdin, stdout\nfrom os import path\nif path.exists('input.txt'):\n\tstdin = open('input.txt', 'r')\n\tstdout = open('output.txt', 'w')\n\n\tdef I():\n\t\treturn int(input())\n\n\tdef In():\n\t\treturn map(int, input().split())\nelse:\n\n\tdef I():\n\t\treturn int(stdin.readline())\n\n\tdef In():\n\t\treturn map(int, stdin.readline().split())\n\n\tdef S():\n\t\treturn stdin.readline().rstrip()\n\n\tdef Sn():\n\t\treturn stdin.readline().split(' ')\n\ndef Out(whatever):\n\treturn stdout.write(whatever)\n\ndef func(s):\n\ts = ''.join((s, 'R'))\n\tl = []\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tm = -1\n\tk = len(l)\n\tif k == 0:\n\t\treturn n + 1\n\tprev = 0\n\tfor i in range(k):\n\t\tm = max(m, l[i] - prev)\n\t\tprev = l[i]\n\treturn m\nt = I()\nans = ['  '] * t\nfor i in range(t):\n\ts = S()\n\tans[i] = str(func(s))\nOut('\\n'.join(ans))\n", "testes = int(input())\nfor t in range(testes):\n\tstring = str(input())\n\tmaior = 0\n\tatual = -1\n\tfor k in range(len(string)):\n\t\tif string[k] == 'R':\n\t\t\tdist = abs(k - atual)\n\t\t\tatual = k\n\t\t\tif maior < dist:\n\t\t\t\tmaior = dist\n\tdist = abs(len(string) - atual)\n\tif dist > maior:\n\t\tmaior = dist\n\tprint(maior)\n", "from sys import stdin\ninput()\nfor line in stdin:\n\ts = line.strip()\n\tarr = [0] + [idx + 1 for (idx, ch) in enumerate(s) if ch == 'R'] + [len(s) + 1]\n\tit = iter(arr)\n\tnext(it)\n\tans = max(map(lambda p: p[1] - p[0], zip(iter(arr), it)))\n\tprint(ans)\n", "import sys\nsys.setrecursionlimit(100000)\ninput = sys.stdin.readline\nINF = 2 ** 62 - 1\n\ndef read_int():\n\treturn int(input())\n\ndef read_int_n():\n\treturn list(map(int, input().split()))\n\ndef read_float():\n\treturn float(input())\n\ndef read_float_n():\n\treturn list(map(float, input().split()))\n\ndef read_str():\n\treturn input().strip()\n\ndef read_str_n():\n\treturn list(map(str, input().split()))\n\ndef error_print(*args):\n\tprint(*args, file=sys.stderr)\n\nclass Bisect:\n\n\tdef __init__(self, func):\n\t\tself.__func = func\n\n\tdef bisect_left(self, x, lo, hi):\n\t\twhile lo < hi:\n\t\t\tmid = (lo + hi) // 2\n\t\t\tif self.__func(mid) < x:\n\t\t\t\tlo = mid + 1\n\t\t\telse:\n\t\t\t\thi = mid\n\t\treturn lo\n\n\tdef bisect_right(self, x, lo, hi):\n\t\twhile lo < hi:\n\t\t\tmid = (lo + hi) // 2\n\t\t\tif x < self.__func(mid):\n\t\t\t\thi = mid\n\t\t\telse:\n\t\t\t\tlo = mid + 1\n\t\treturn lo\n\ndef slv(S):\n\tS = 'R' + S + 'G'\n\tN = len(S)\n\n\tdef dfs(d):\n\t\ts = list(range(1, d + 1))\n\t\tdone = set(s)\n\t\tdone.add(0)\n\t\tdi = d + 1\n\t\twhile s:\n\t\t\tu = s.pop()\n\t\t\tif S[u] == 'R':\n\t\t\t\tfor i in range(max(u + 1, di), u + d + 1):\n\t\t\t\t\tif i < N:\n\t\t\t\t\t\tif i not in done:\n\t\t\t\t\t\t\ts.append(i)\n\t\t\t\t\t\t\tdone.add(i)\n\t\t\t\tdi = u + d + 1\n\t\t\tif N - 1 in done:\n\t\t\t\treturn 1\n\t\treturn 0\n\tb = Bisect(dfs)\n\treturn b.bisect_left(1, 0, N)\n\ndef main():\n\tT = read_int()\n\tfor _ in range(T):\n\t\tS = read_str()\n\t\tprint(slv(S))\nmain()\n", "def run_length_compress(string):\n\tstring = string + '@'\n\tn = len(string)\n\tbegin = 0\n\tend = 1\n\tcnt = 1\n\tans = []\n\twhile True:\n\t\tif end >= n:\n\t\t\tbreak\n\t\tif string[begin] == string[end]:\n\t\t\tend += 1\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tans.append((cnt, string[begin]))\n\t\t\tbegin = end\n\t\t\tend = begin + 1\n\t\t\tcnt = 1\n\treturn ans\nimport sys\ninput = sys.stdin.readline\nt = int(input())\nfor i in range(t):\n\ts = input()\n\ts = run_length_compress(s[0:-1])\n\tans = 1\n\tfor (num, char) in s:\n\t\tif char == 'L':\n\t\t\tans = max(num + 1, ans)\n\tprint(ans)\n", "import sys\nimport math\nimport itertools\nfrom collections import deque\nN = 200005\ninf = 1 << 30\n\ndef solve():\n\ts = input()\n\tpos = []\n\tn = len(s)\n\tpos.append(0)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tpos.append(i + 1)\n\tpos.append(n + 1)\n\tans = 0\n\tn = len(pos)\n\tfor i in range(1, n):\n\t\tans = max(ans, pos[i] - pos[i - 1])\n\tprint(ans)\nt = int(input())\nfor case in range(t):\n\tsolve()\n", "t = int(input())\nwhile t > 0:\n\ts = input()\n\tans = 1\n\ti = 0\n\tl = len(s)\n\twhile i < len(s):\n\t\tif s[i] == 'R':\n\t\t\ti += 1\n\t\telse:\n\t\t\tcnt = 1\n\t\t\tj = i\n\t\t\twhile j < l and s[j] == 'L':\n\t\t\t\tj += 1\n\t\t\t\tcnt += 1\n\t\t\ti = j\n\t\t\tif cnt > ans:\n\t\t\t\tans = cnt\n\tprint(ans)\n\tt -= 1\n", "for TC in range(int(input())):\n\ts = input()\n\tresult = 0\n\tr = s.split('R')\n\tfor i in r:\n\t\tresult = max(result, len(i))\n\tprint(result + 1)\n", "def frog(s):\n\tc = 0\n\tz = [0]\n\tfor r in s:\n\t\tif r == 'L':\n\t\t\tc += 1\n\t\tif r == 'R':\n\t\t\tz.append(c)\n\t\t\tc = 0\n\tif c != 0:\n\t\tz.append(c)\n\treturn max(z) + 1\na = int(input())\nfor r in range(a):\n\tm = input()\n\to = frog(m)\n\tprint(o)\n", "n = int(input())\nfor i in range(n):\n\ts = str(input())\n\ta = 'R' + s + 'R'\n\tm = -1\n\tcur = -1\n\tfor j in range(len(a)):\n\t\tif a[j] == 'R':\n\t\t\tm = max(m, j - cur)\n\t\t\tcur = j\n\tprint(m)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tb = []\n\tb.append(0)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tb.append(i + 1)\n\tans = -2 ** 34\n\tb.append(n + 1)\n\tfor i in range(1, len(b)):\n\t\tans = max(ans, b[i] - b[i - 1])\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = list(input().split('R'))\n\ts.sort(reverse=True)\n\tprint(len(s[0]) + 1)\n", "from sys import stdin, stdout\nimport math\nfrom itertools import permutations, combinations\nfrom collections import defaultdict\n\ndef L():\n\treturn list(map(int, stdin.readline().split()))\n\ndef In():\n\treturn map(int, stdin.readline().split())\n\ndef I():\n\treturn int(stdin.readline())\nP = 1000000007\nfor t in range(I()):\n\ts = input()\n\tc = 0\n\tmx = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\t\tmx = max(c, mx)\n\tprint(mx + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = list(input())\n\ttry:\n\t\tk1 = s.index('R')\n\t\ts.reverse()\n\t\tk2 = s.index('R')\n\t\tk3 = 0\n\t\tif s.count('R') == 1:\n\t\t\tprint(max(k1 + 1, k2 + 1))\n\t\telse:\n\t\t\tc = []\n\t\t\tfor i in range(len(s)):\n\t\t\t\tif s[i] == 'R':\n\t\t\t\t\tc.append(i)\n\t\t\tp = 0\n\t\t\tfor i in range(len(c) - 1):\n\t\t\t\tp = max(p, c[i + 1] - c[i])\n\t\t\tprint(max(p, max(k1 + 1, k2 + 1)))\n\texcept:\n\t\tprint(len(s) + 1)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\ntestcases = int(input())\nfor j in range(testcases):\n\tjumps = input()\n\trights = []\n\tgaps = []\n\tfor s in range(len(jumps)):\n\t\tif jumps[s] == 'R':\n\t\t\trights.append(s)\n\t\tif len(rights) == 1:\n\t\t\tgaps.append(rights[0] + 1)\n\t\telif len(rights) >= 2:\n\t\t\tgaps.append(rights[-1] - rights[-2])\n\tif len(gaps) == 0:\n\t\tprint(len(jumps) + 1)\n\telif len(rights) != 0:\n\t\tgaps.append(len(jumps) - rights[-1])\n\t\tprint(max(gaps))\n", "import sys\ninput = sys.stdin.readline\nimport re\nfor _ in range(int(input())):\n\tprint(max(map(len, re.split('R+', input()[:-1]))) + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tl = list(s)\n\ts1 = list(set(l))\n\tif len(s1) == 1:\n\t\tif s1[0] == 'L':\n\t\t\tprint(len(l) + 1)\n\t\telif s1[0] == 'R':\n\t\t\tprint(1)\n\telse:\n\t\tl1 = s.split('R')\n\t\tc = 1\n\t\tfor j in l1:\n\t\t\tx = list(j)\n\t\t\tc = max(c, len(x))\n\t\tprint(c + 1)\n", "testcase = int(input())\nwhile testcase > 0:\n\ta = list(input())\n\tb = list()\n\tcount = 0\n\tlst = -1\n\tfor i in range(0, len(a)):\n\t\tif a[i] == 'R' and count == 0:\n\t\t\tb.append(i + 1)\n\t\t\tcount += 1\n\t\t\tlst = i\n\t\telif a[i] == 'R':\n\t\t\tb.append(i - lst)\n\t\t\tcount += 1\n\t\t\tlst = i\n\tif lst == -1:\n\t\tb.append(len(a) + 1)\n\telse:\n\t\tb.append(len(a) - lst)\n\tprint(max(b))\n\ttestcase -= 1\n", "for _ in '0' * int(input()):\n\ts = 'R' + input() + 'R'\n\t(f, max_r) = (0, 0)\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmax_r = max(max_r, i - f)\n\t\t\tf = i\n\tprint(max_r)\n", "t = int(input())\nfor im in range(t):\n\ts = input()\n\tn = len(s)\n\tr = 0\n\tfirstr = -1\n\tlastr = -1\n\tcons_gap = -1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tr = 1\n\t\t\tif lastr != -1:\n\t\t\t\tcons_gap = max(cons_gap, i - lastr)\n\t\t\tlastr = i\n\t\t\tif firstr == -1:\n\t\t\t\tfirstr = i\n\tif r:\n\t\tprint(max(n - lastr, firstr + 1, cons_gap))\n\telse:\n\t\tprint(n + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tl = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\tz = float('-inf')\n\tfor j in range(1, len(l)):\n\t\tz = max(l[j] - l[j - 1], z)\n\tprint(z)\n", "for _ in range(int(input())):\n\ts = input()\n\t(ctr, ctr2) = (1, 0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tctr += 1\n\t\telse:\n\t\t\tctr2 = max(ctr2, ctr)\n\t\t\tctr = 1\n\tif s[-1] == 'L':\n\t\tctr2 = max(ctr2, ctr)\n\tprint(ctr2)\n", "def solve(map_):\n\tmax_continuous_l = 0\n\tcontinuous_l = 0\n\tfor c in map_:\n\t\tif c == 'R':\n\t\t\tif max_continuous_l < continuous_l:\n\t\t\t\tmax_continuous_l = continuous_l\n\t\t\tcontinuous_l = 0\n\t\telif c == 'L':\n\t\t\tcontinuous_l += 1\n\tif max_continuous_l < continuous_l:\n\t\tmax_continuous_l = continuous_l\n\treturn max_continuous_l + 1\nn = int(input())\nfor i in range(n):\n\tprint(solve(input()))\n", "from sys import stdin, stdout\nimport math\nfrom collections import Counter, deque\nL = lambda : list(map(int, stdin.readline().strip().split()))\nM = lambda : map(int, stdin.readline().strip().split())\nI = lambda : int(stdin.readline().strip())\nIN = lambda : stdin.readline().strip()\nC = lambda : stdin.readline().strip().split()\nmod = 1000000007\n\ndef s(a):\n\tprint(' '.join(list(map(str, a))))\nfor i in range(I()):\n\ts = IN()\n\ts = s.split('R')\n\tprint(len(max(s)) + 1)\n", "T = int(input())\nfor i in range(T):\n\tn = input()\n\tl = [0]\n\tfor j in range(len(n)):\n\t\tif n[j] == 'R':\n\t\t\tl.append(j + 1)\n\tdiff = []\n\tfor j in range(1, len(l)):\n\t\tdiff.append(l[j] - l[j - 1])\n\tdiff.append(len(n) + 1 - l[len(l) - 1])\n\tprint(max(diff))\n", "t = int(input())\nfor el in range(t):\n\tst = input()\n\tst = st + 'R'\n\tv = 0\n\tf = -1\n\ts = 0\n\twhile s < len(st):\n\t\tif st[s] == 'R':\n\t\t\tv = max(s - f, v)\n\t\t\tf = s\n\t\ts += 1\n\tprint(v)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\ti = 0\n\tf = 0\n\twhile i < n + 1:\n\t\tif i == n:\n\t\t\tm = n + 1\n\t\t\tf = 1\n\t\t\tbreak\n\t\telif s[i] == 'R':\n\t\t\tm = i + 1\n\t\t\tj = i\n\t\t\tf = 1\n\t\t\tbreak\n\t\ti += 1\n\ti += 1\n\twhile i < n + 1:\n\t\tif i == n:\n\t\t\tm1 = i - j\n\t\t\tif m1 > m:\n\t\t\t\tm = m1\n\t\t\tj = i\n\t\telif s[i] == 'R' and f == 0:\n\t\t\tj = i\n\t\t\tf = 1\n\t\telif s[i] == 'R' and f == 1:\n\t\t\tm1 = i - j\n\t\t\tif m1 > m:\n\t\t\t\tm = m1\n\t\t\tj = i\n\t\ti += 1\n\tprint(m)\n", "def solve():\n\ts = input()\n\tnl = 0\n\tmax_nl = -1\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tnl += 1\n\t\telse:\n\t\t\tnl = 0\n\t\tmax_nl = max(max_nl, nl)\n\tprint(max_nl + 1)\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "t = int(input())\nfor _ in range(t):\n\td = 0\n\tprev = 0\n\tstr = '0' + input() + '0'\n\tfor i in range(len(str)):\n\t\tif str[i] == 'R' or i == len(str) - 1:\n\t\t\tif i - prev > d:\n\t\t\t\td = i - prev\n\t\t\tprev = i\n\tprint(d)\n", "for i in range(int(input())):\n\tt = input()\n\ts = t.split('R')\n\ta = [len(str(x)) for x in s]\n\tprint(max(a) + 1)\n", "for t in range(int(input())):\n\tst = input()\n\tn = len(st)\n\tcurrent = -1\n\tdist = 0\n\tfor i in range(n):\n\t\tif st[i] == 'R':\n\t\t\tif i - current > dist:\n\t\t\t\tdist = i - current\n\t\t\tcurrent = i\n\telse:\n\t\ti = n\n\t\tif i - current > dist:\n\t\t\tdist = i - current\n\t\tcurrent = i\n\tif dist == 0:\n\t\tprint(n + 1)\n\telse:\n\t\tprint(dist)\n", "import sys\ninput = sys.stdin.readline\nq = int(input())\nfor _ in range(q):\n\tS = 'R' + input().rstrip() + 'R'\n\tans = -1\n\tprv = 0\n\tfor i in range(1, len(S)):\n\t\tif S[i] == 'R':\n\t\t\tdiff = i - prv\n\t\t\tans = max(ans, diff)\n\t\t\tprv = i\n\tprint(ans)\n", "import sys\nt = int(input())\nfor _ in range(t):\n\tnums = input()\n\t(max_now, max_l) = (0, 0)\n\tfor ch in nums:\n\t\tif ch == 'L':\n\t\t\tmax_now += 1\n\t\t\tif max_l < max_now:\n\t\t\t\tmax_l = max_now\n\t\telse:\n\t\t\tmax_now = 0\n\tprint(max_l + 1)\n", "T = int(input())\nfor case in range(T):\n\tstate = input()\n\tnums_ = {}\n\tjump = 1\n\tmax_jump = 1\n\tfor s in state:\n\t\tif s == 'L':\n\t\t\tjump += 1\n\t\telse:\n\t\t\tmax_jump = max(max_jump, jump)\n\t\t\tjump = 1\n\tmax_jump = max(max_jump, jump)\n\tprint(max_jump)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport heapq as h\nfrom bisect import bisect_left\nfrom types import GeneratorType\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\timport os\n\t\tself.os = os\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tself.os.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport time\nstart_time = time.time()\nimport collections as col\nimport math, string\nfrom functools import reduce\n\ndef getInts():\n\treturn [int(s) for s in input().split()]\n\ndef getInt():\n\treturn int(input())\n\ndef getStrs():\n\treturn [s for s in input().split()]\n\ndef getStr():\n\treturn input()\n\ndef listStr():\n\treturn list(input())\nMOD = 10 ** 9 + 7\n\ndef solve():\n\tS = listStr()\n\tbest = 0\n\tcurr = 0\n\tfor i in range(len(S)):\n\t\tif S[i] == 'L':\n\t\t\tcurr += 1\n\t\telse:\n\t\t\tbest = max(curr, best)\n\t\t\tcurr = 0\n\tbest = max(best, curr)\n\treturn best + 1\nfor _ in range(getInt()):\n\tprint(solve())\n", "testnum = int(input())\nres = []\nfor i in range(testnum):\n\ta = input()\n\tres.append(len(a) + 1)\n\tmax = a.find('R') + 1\n\tfor j in range(len(a)):\n\t\tif a[j] == 'R':\n\t\t\tif a.find('R', j + 1, len(a)) != -1:\n\t\t\t\ttemp = a.find('R', j + 1, len(a)) - j\n\t\t\telse:\n\t\t\t\ttemp = len(a) - j\n\t\t\tif temp > max:\n\t\t\t\tmax = temp\n\tif max != 0:\n\t\tres[i] = max\nfor i in range(testnum):\n\tprint(res[i])\n", "def solve():\n\ts = input()\n\tl = []\n\tl.append(0)\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\tmx = 0\n\tfor i in range(len(l) - 1):\n\t\tmx = max(mx, l[i + 1] - l[i])\n\tprint(mx)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools\nsys.setrecursionlimit(10 ** 7)\ninf = 10 ** 20\neps = 1.0 / 10 ** 10\nmod = 10 ** 9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\ndef LI():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef LLI():\n\treturn [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\ndef LI_():\n\treturn [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF():\n\treturn [float(x) for x in sys.stdin.readline().split()]\n\ndef LS():\n\treturn sys.stdin.readline().split()\n\ndef I():\n\treturn int(sys.stdin.readline())\n\ndef F():\n\treturn float(sys.stdin.readline())\n\ndef S():\n\treturn input()\n\ndef pf(s):\n\treturn print(s, flush=True)\n\ndef pe(s):\n\treturn print(str(s), file=sys.stderr)\n\ndef JA(a, sep):\n\treturn sep.join(map(str, a))\n\ndef JAA(a, s, t):\n\treturn s.join((t.join(map(str, b)) for b in a))\n\ndef IF(c, t, f):\n\treturn t if c else f\n\ndef main():\n\tt = I()\n\trr = []\n\tfor _ in range(t):\n\t\ts = S()\n\t\tn = len(s)\n\t\tr = 0\n\t\tc = -1\n\t\tfor i in range(n):\n\t\t\tif s[i] == 'L':\n\t\t\t\tcontinue\n\t\t\tt = i - c\n\t\t\tif r < t:\n\t\t\t\tr = t\n\t\t\tc = i\n\t\tt = n - c\n\t\tif r < t:\n\t\t\tr = t\n\t\trr.append(r)\n\treturn JA(rr, '\\n')\nprint(main())\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tans = 0\n\tcnt = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tcnt = 0\n\t\t\tcontinue\n\t\telse:\n\t\t\tcnt += 1\n\t\tans = max(ans, cnt)\n\tprint(ans + 1)\n", "import math\nimport bisect\n\ndef test(data):\n\tbest = 1\n\tcount = 1\n\tfor letter in data:\n\t\tif letter == 'L':\n\t\t\tcount += 1\n\t\t\tbest = max(best, count)\n\t\tif letter == 'R':\n\t\t\tcount = 1\n\treturn best\nT = int(input())\nfor i in range(T):\n\tdata = list(input())\n\tprint(test(data))\n", "t = int(input())\nfor i in range(t):\n\tf = 0\n\ts = input()\n\tif 'L' in s:\n\t\tpass\n\telse:\n\t\tf = 1\n\t\tprint('1')\n\tif 'R' in s:\n\t\tpass\n\telse:\n\t\tf = 1\n\t\tc = len(s) + 1\n\t\tprint(c)\n\tif f != 1:\n\t\td = len(s)\n\t\tlst = [-1]\n\t\tlst1 = []\n\t\tl = list(s)\n\t\tfor k in range(d):\n\t\t\tif l[k] == 'R':\n\t\t\t\tlst.append(k)\n\t\tlst.append(d)\n\t\tfor k2 in range(1, len(lst)):\n\t\t\tlst1.append(lst[k2] - lst[k2 - 1])\n\t\tprint(max(lst1))\n", "from math import *\nfrom collections import *\nfrom operator import itemgetter\nimport bisect\nii = lambda : int(input())\niia = lambda : list(map(int, input().split()))\nisa = lambda : list(input().split())\nI = lambda : list(map(int, input().split()))\nchrIdx = lambda x: ord(x) - 96\nidxChr = lambda x: chr(96 + x)\nt = ii()\nfor i in range(t):\n\ts = input()\n\tmaxi = 0\n\tcur = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\tcur += 1\n\t\telse:\n\t\t\tmaxi = max(maxi, cur)\n\t\t\tcur = 0\n\tmaxi = max(cur, maxi)\n\tprint(maxi + 1)\n", "for _ in range(int(input())):\n\tb = list(map(str, input().split('R')))\n\th = []\n\tfor i in b:\n\t\th.append(len(i))\n\tprint(max(h) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = 'R' + input() + 'R'\n\tdist = -1\n\tlast = 0\n\tfor (i, letter) in enumerate(s):\n\t\tif letter == 'R':\n\t\t\tdist = max(i - last, dist)\n\t\t\tlast = i\n\tprint(dist)\n", "for i in range(int(input())):\n\ts = input()\n\tans = 0\n\tcnt = 0\n\tfor j in range(s.find('L'), s.rfind('L') + 1):\n\t\tif s[j] == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tif ans < cnt:\n\t\t\t\tans = cnt\n\t\t\tcnt = 0\n\tprint(max(ans, cnt) + 1)\n", "for i in range(int(input())):\n\ts = input()\n\tl = []\n\tl.append('R')\n\tfor j in s:\n\t\tl.append(j)\n\tl.append('R')\n\tl1 = []\n\tfor j in range(len(l)):\n\t\tif l[j] == 'R':\n\t\t\tl1.append(j)\n\tmaxi = 0\n\tfor j in range(len(l1) - 1):\n\t\ta = l1[j + 1] - l1[j]\n\t\tif maxi < a:\n\t\t\tmaxi = a\n\tprint(maxi)\n", "for i in range(int(input())):\n\ts = str(input())\n\ts = 'R' + s + 'R'\n\ta = s.count('R')\n\tli = []\n\tif a == len(s):\n\t\tprint(1)\n\telif a == 0:\n\t\tprint(len(s) - 1)\n\telse:\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tli.append(i)\n\t\tmax = 0\n\t\tfor i in range(len(li) - 1):\n\t\t\tif li[i + 1] - li[i] > max:\n\t\t\t\tmax = li[i + 1] - li[i]\n\t\tprint(max)\n", "querys = int(input())\nsaida = 0\ntamanho = 0\nfor i in range(querys):\n\tentrada = list(input())\n\tentrada.append('R')\n\ttamanho = len(entrada)\n\tsaida = 1\n\tfor i in range(tamanho - 1, -1, -1):\n\t\tif entrada[i] == 'R':\n\t\t\tsaida = max(saida, tamanho - i)\n\t\t\ttamanho = i\n\tif entrada[0] != 'R':\n\t\tsaida = max(saida, tamanho + 1)\n\tprint(saida)\n", "t = int(input())\nfor _ in range(t):\n\ta = input()\n\tn = len(a)\n\tx = list(a)\n\tcoun = 0\n\tfor i in x:\n\t\tif i == 'L':\n\t\t\tcoun += 1\n\t\telse:\n\t\t\tcoun += 1\n\t\t\tbreak\n\t(count, temp) = (1, 1)\n\tfor i in range(1, len(x)):\n\t\tif x[i] == x[i - 1] and x[i] == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tcount = max(count, temp)\n\t\t\ttemp = 1\n\tif x.count('R') != n:\n\t\tcount = max(count, temp) + 1\n\telse:\n\t\tcount = max(count, temp)\n\tprint(max(count, coun))\n", "for _ in range(int(input())):\n\tlst = list(input())\n\tn = len(lst)\n\td = 0\n\tcnt = 0\n\tfor i in range(n):\n\t\tif lst[i] == 'L':\n\t\t\tcnt += 1\n\t\t\tif cnt > d:\n\t\t\t\td = cnt\n\t\telse:\n\t\t\tcnt = 0\n\tprint(d + 1)\n", "for _ in range(int(input())):\n\ts = list(input())\n\tl = 1\n\tans = 1\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tans = max(ans, l)\n\t\t\tl = 1\n\tans = max(ans, l)\n\tprint(ans)\n", "from collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappush, heappop, heappushpop\nfrom sys import stdin\nint_inp = lambda : int(stdin.readline().strip())\nlst_inp = lambda : [int(i) for i in stdin.readline().strip().split(' ')]\nstr_inp = lambda : stdin.readline().strip()\n\ndef solve(s):\n\tn = len(s) - 1\n\tmax_d = 0\n\ti = 1\n\twhile i <= n:\n\t\td = 1\n\t\twhile i <= n and s[i] not in {'R', '#'}:\n\t\t\td += 1\n\t\t\ti += 1\n\t\tmax_d = max(d, max_d)\n\t\ti += 1\n\treturn max_d\nfor _ in range(int_inp()):\n\ts = '#' + str_inp() + '#'\n\tprint(solve(s))\n", "for i in range(int(input())):\n\tstr1 = input()\n\tR = [0, len(str1) + 1]\n\tDiff = []\n\tfor j in range(len(str1)):\n\t\tif str1[j] == 'R':\n\t\t\tR.append(j + 1)\n\tR.sort()\n\tfor k in range(len(R) - 1):\n\t\tDiff.append(R[k + 1] - R[k])\n\tprint(max(Diff))\n", "import io\nimport os\nfrom collections import Counter, defaultdict, deque\n\ndef solve(S):\n\tN = len(S)\n\tminGap = 0\n\tlast = 0\n\tfor (i, x) in enumerate(S, 1):\n\t\tif x == 'R':\n\t\t\tminGap = max(minGap, i - last)\n\t\t\tlast = i\n\tminGap = max(minGap, N + 1 - last)\n\treturn minGap\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nT = int(input())\nfor t in range(T):\n\tS = input().decode().rstrip()\n\tans = solve(S)\n\tprint(ans)\n", "import math\nt = int(input())\nfor z in range(t):\n\tn = input()\n\ti = count = maxx = 0\n\twhile True:\n\t\tif i == len(n):\n\t\t\tbreak\n\t\tif n[i] == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > maxx:\n\t\t\t\tmaxx = count\n\t\t\tcount = 0\n\t\ti += 1\n\tif count > maxx:\n\t\tmaxx = count\n\tif maxx == 0:\n\t\tprint(1)\n\telse:\n\t\tprint(maxx + 1)\n", "t = int(input())\nfor i in range(0, t):\n\ts = input()\n\tn = len(s)\n\tr = []\n\tr.append(0)\n\tfor i in range(0, n):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(n + 1)\n\tll = len(r)\n\tmx = 0\n\tfor i in range(0, ll - 1):\n\t\tmx = max(mx, r[i + 1] - r[i])\n\tprint(mx)\n", "t = int(input())\nfor _ in range(t):\n\ts = input() + 'R'\n\tprev_r = -1\n\tmin_d = 1\n\tfor (idx, sym) in enumerate(s):\n\t\tif sym == 'R':\n\t\t\tmin_d = max(min_d, idx - prev_r)\n\t\t\tprev_r = idx\n\tprint(min_d)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tl = []\n\ta = -1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tl.append(j - a)\n\t\t\ta = j\n\tl.append(len(s) - a)\n\tprint(max(l))\n", "for i in range(int(input())):\n\ts = 'R' + input() + 'R'\n\tprev = 0\n\tma = -1\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tma = max(ma, i - prev)\n\t\t\tprev = i\n\tprint(ma)\n", "n = int(input())\nsaida = []\nfor k in range(n):\n\tentrada = input()\n\taux = []\n\ti = 0\n\twhile i < len(entrada):\n\t\ts = 0\n\t\twhile entrada[i] == 'L':\n\t\t\ts += 1\n\t\t\ti += 1\n\t\t\tif i == len(entrada):\n\t\t\t\tbreak\n\t\tif s > 0:\n\t\t\taux.append(s)\n\t\telse:\n\t\t\ti += 1\n\taux.sort()\n\tif len(aux) > 0:\n\t\tsaida.append(aux[len(aux) - 1] + 1)\n\telse:\n\t\tsaida.append(1)\nfor l in saida:\n\tprint(l)\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\n\ndef pr_list(a):\n\tprint(*a, sep=' ')\n\ndef main():\n\ttests = inp()\n\tfor test in range(tests):\n\t\tarr = insr()\n\t\tpivot = len(arr) + 1\n\t\tg_max = 1\n\t\tfor i in range(len(arr) - 1, -1, -1):\n\t\t\tif arr[i] == 'R':\n\t\t\t\tpivot = i + 1\n\t\t\telse:\n\t\t\t\tg_max = max(g_max, pivot - i)\n\t\tprint(g_max)\n\treturn 0\nmain()\n", "cases = int(input())\nwhile cases > 0:\n\taux = input()\n\ts = 'R'\n\ts += aux\n\ts += 'R'\n\tbefore = 0\n\tb = False\n\tmaxi = -1\n\tfor i in range(1, len(s), 1):\n\t\tif s[i] == 'R':\n\t\t\tif maxi < i - before:\n\t\t\t\tmaxi = i - before\n\t\t\tbefore = i\n\tprint(maxi)\n\tcases -= 1\n", "for _ in range(int(input())):\n\ts = input()\n\tcur = 0\n\tr = [0]\n\tl = len(s)\n\tfor i in range(l):\n\t\tif s[i] == 'R':\n\t\t\tr.append(i + 1)\n\tr.append(l + 1)\n\tfor i in range(1, len(r)):\n\t\tif r[i] - r[i - 1] > cur:\n\t\t\tcur = r[i] - r[i - 1]\n\tprint(cur)\n", "import bisect\nimport os\nimport gc\nimport sys\nfrom io import BytesIO, IOBase\nfrom collections import Counter\nfrom collections import deque\nimport heapq\nimport math\nimport statistics\n\ndef sin():\n\treturn input()\n\ndef ain():\n\treturn list(map(int, sin().split()))\n\ndef sain():\n\treturn input().split()\n\ndef iin():\n\treturn int(sin())\nMAX = float('inf')\nMIN = float('-inf')\nMOD = 1000000007\n\ndef readTree(n, m):\n\tadj = [deque([]) for _ in range(n + 1)]\n\tfor _ in range(m):\n\t\t(u, v) = ain()\n\t\tadj[u].append(v)\n\t\tadj[v].append(u)\n\treturn adj\n\ndef main():\n\tfor __ in range(iin()):\n\t\ts = sin()\n\t\tn = len(s)\n\t\ts = 'R' + s\n\t\tx = 0\n\t\tmaxi = MIN\n\t\tfor i in range(n + 1):\n\t\t\tif s[i] == 'R':\n\t\t\t\tmaxi = max(maxi, i - x)\n\t\t\t\tx = i\n\t\tmaxi = max(maxi, n + 1 - x)\n\t\tprint(maxi)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tx = [0]\n\tfor j in range(len(s)):\n\t\tif s[j] == 'R':\n\t\t\tx.append(j + 1)\n\tx.append(len(s) + 1)\n\tx1 = []\n\tfor j in range(1, len(x)):\n\t\tx1.append(x[j] - x[j - 1])\n\tx1.sort()\n\tprint(x1[len(x1) - 1])\n", "t = int(input())\nfor j in range(0, t):\n\ts = str(input())\n\ts = list(s)\n\tk = 0\n\tb = []\n\tfor i in range(0, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tb.append(i + 1 - k)\n\t\t\tk = i + 1\n\tb.append(len(s) + 1 - k)\n\tprint(max(b))\n", "t = int(input())\ni = 0\nwhile i < t:\n\tx = [*str(input())]\n\tlenn = len(x) + 1\n\tx.append('R')\n\tmaxi = 0\n\tlast = -1\n\tj = 0\n\twhile j < lenn:\n\t\tif x[j] == 'R':\n\t\t\tmaxi = max(maxi, j - last)\n\t\t\tlast = j\n\t\tj += 1\n\tif maxi == 0:\n\t\tprint(lenn)\n\telse:\n\t\tprint(maxi)\n\ti += 1\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tif 'R' not in s:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tp = []\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'R':\n\t\t\t\tp.append(i)\n\t\tmx = p[0] + 1\n\t\tfor j in range(1, len(p)):\n\t\t\tmx = max(mx, p[j] - p[j - 1])\n\t\tmx = max(mx, len(s) - p[-1])\n\t\tprint(mx)\n", "for x in range(int(input())):\n\td = [x for x in input()]\n\tif 'L' not in d:\n\t\tprint(1)\n\telse:\n\t\ti = 0\n\t\tc = 0\n\t\tfor x in range(len(d)):\n\t\t\tif d[x] == 'L':\n\t\t\t\tc += 1\n\t\t\telse:\n\t\t\t\tif i < c:\n\t\t\t\t\ti = c\n\t\t\t\tc = 0\n\t\tif i < c:\n\t\t\ti = c\n\t\tprint(i + 1)\n", "t = int(input())\nfor _ in range(t):\n\tstring = input()\n\tcount = 0\n\tmax_count = 0\n\tfor ch in string:\n\t\tif ch == 'L':\n\t\t\tcount += 1\n\t\telse:\n\t\t\tif count > max_count:\n\t\t\t\tmax_count = count\n\t\t\tcount = 0\n\tif count > max_count:\n\t\tmax_count = count\n\tprint(max_count + 1)\n", "for _ in range(int(input())):\n\ta = p = -1\n\tfor (i, c) in enumerate(input().rstrip() + 'R'):\n\t\tif c == 'R':\n\t\t\ta = max(a, i - p)\n\t\t\tp = i\n\tprint(a)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tmaxx = -1\n\tch = 'R'\n\ti = 0\n\twhile i < n:\n\t\tcount = 1\n\t\twhile i < n and s[i] != 'R':\n\t\t\tcount += 1\n\t\t\ti += 1\n\t\tif count > maxx:\n\t\t\tmaxx = count\n\t\ti += 1\n\tprint(maxx)\n", "def solve(squares):\n\tr_idx = [i for (i, char) in enumerate(squares) if char == 'R']\n\tmax_dist = -float('inf')\n\tfor i in range(len(r_idx) - 1):\n\t\tdiff = r_idx[i + 1] - r_idx[i]\n\t\tmax_dist = max(max_dist, diff)\n\treturn max_dist\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\tsquares = ['R']\n\tfor char in s:\n\t\tsquares.append(char)\n\tsquares.append('R')\n\tprint(solve(squares))\n", "a = int(input())\nfor _ in range(a):\n\tl = input()\n\tx = [0]\n\tfor i in range(len(l)):\n\t\tif l[i] == 'R':\n\t\t\tx.append(i + 1)\n\tx.append(len(l) + 1)\n\tp = 0\n\tfor i in range(0, len(x), 1):\n\t\tp = max(p, x[i] - x[i - 1])\n\tprint(p)\n", "T = int(input())\nfor _ in range(T):\n\ts = 'R' + input()\n\ti = len(s)\n\td = 1\n\twhile i > 0:\n\t\tj = i - 1\n\t\twhile s[j] != 'R':\n\t\t\tj -= 1\n\t\td = max(d, i - j)\n\t\ti = j\n\tprint(d)\n", "quant_testes = int(input())\nfor c in range(quant_testes):\n\tseq = input() + 'R'\n\tmaior_slice = 0\n\tslice_atual = 0\n\tfor char in seq:\n\t\tif char == 'L':\n\t\t\tslice_atual += 1\n\t\telse:\n\t\t\tif slice_atual > maior_slice:\n\t\t\t\tmaior_slice = slice_atual\n\t\t\tslice_atual = 0\n\tprint(maior_slice + 1)\n", "import sys\nstdin = sys.stdin\ninf = 1 << 60\nmod = 1000000007\nni = lambda : int(ns())\nnin = lambda y: [ni() for _ in range(y)]\nna = lambda : list(map(int, stdin.readline().split()))\nnan = lambda y: [na() for _ in range(y)]\nnf = lambda : float(ns())\nnfn = lambda y: [nf() for _ in range(y)]\nnfa = lambda : list(map(float, stdin.readline().split()))\nnfan = lambda y: [nfa() for _ in range(y)]\nns = lambda : stdin.readline().rstrip()\nnsn = lambda y: [ns() for _ in range(y)]\nncl = lambda y: [list(ns()) for _ in range(y)]\nnas = lambda : stdin.readline().split()\n\ndef sol():\n\ts = ns()\n\ts = 'R' + s + 'R'\n\tn = len(s)\n\tans = -inf\n\tlast = 0\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, abs(last - i))\n\t\t\tlast = i\n\tprint(ans)\nfor i in range(ni()):\n\tsol()\n", "from collections import Counter\nt = int(input())\nfor wer in range(t):\n\tf = 0\n\ta = list(input().split())\n\tn = len(a[0])\n\tx = a[0]\n\td = n + 1\n\tprev = 0\n\tli = []\n\ty = 'L' + x\n\tfor i in range(n + 1):\n\t\tif y[i] == 'R':\n\t\t\tli.append(i - prev)\n\t\t\tprev = i\n\tli.append(n + 1 - prev)\n\tif li:\n\t\td = max(li)\n\tprint(d)\n", "l = int(input())\nfor _ in range(l):\n\tlast_pos = -1\n\tmax_range = -1\n\ts = input() + 'R'\n\tfor (index, letter) in enumerate(s):\n\t\tif letter == 'L':\n\t\t\tcontinue\n\t\tif letter == 'R':\n\t\t\tif index - last_pos > max_range:\n\t\t\t\tmax_range = index - last_pos\n\t\t\tlast_pos = index\n\tprint(max_range)\n", "testcases = int(input())\nfor i in range(testcases):\n\t(res, ans) = (-1, 0)\n\tL1 = list(input())\n\tL1.append('R')\n\tL1.insert(0, 'R')\n\tfor idx in range(1, len(L1)):\n\t\tif L1[idx] != 'L':\n\t\t\tDIFF = idx - ans\n\t\t\tif DIFF > res:\n\t\t\t\tres = DIFF\n\t\t\tans = idx\n\tprint(res)\n", "for _ in range(int(input())):\n\tstr1 = input()\n\tli = []\n\tfor i in range(len(str1)):\n\t\tif str1[i] == 'R':\n\t\t\tli.append(i + 1)\n\tif len(li) == 0:\n\t\tprint(len(str1) + 1)\n\t\tcontinue\n\ta = 0\n\tans = 0\n\tfor i in li:\n\t\tans = max(ans, i - a)\n\t\ta = i\n\tans = max(-li[-1] + 1 + len(str1), ans)\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = input()\n\tmx = -1\n\tl = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tl += 1\n\t\telse:\n\t\t\tmx = max(mx, l)\n\t\t\tl = 0\n\tmx = max(mx, l)\n\tprint(mx + 1)\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\n\ndef zap():\n\ts = input()\n\tn = len(s)\n\ta = []\n\tans = 0\n\tcur = 0\n\twhile cur != n:\n\t\tif s[cur] == 'L':\n\t\t\tans += 1\n\t\telse:\n\t\t\ta.append(ans)\n\t\t\tans = 0\n\t\tcur += 1\n\ta.append(ans)\n\treturn max(a)\nfor _ in range(int(input())):\n\tprint(zap() + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\ts = list(s)\n\ts.insert(0, 0)\n\ts.append(0)\n\tjumps = []\n\tstart = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tjumps.append(i - start)\n\t\t\tstart = i\n\tjumps.append(len(s) - 1 - start)\n\tprint(max(jumps))\n", "t = int(input())\nfor T in range(t):\n\ts = input()\n\tm = 0\n\tcur = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - cur > m:\n\t\t\t\tm = i - cur\n\t\t\tcur = i\n\tif m == 0:\n\t\tprint(len(s) + 1)\n\telse:\n\t\tprint(max(m, len(s) - cur))\n", "import sys\nfrom collections import Counter\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef list2d(a, b, c):\n\treturn [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d):\n\treturn [[[d] * c for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e):\n\treturn [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1):\n\treturn int(-(-x // y))\n\ndef INT():\n\treturn int(input())\n\ndef MAP():\n\treturn map(int, input().split())\n\ndef LIST(N=None):\n\treturn list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes():\n\tprint('Yes')\n\ndef No():\n\tprint('No')\n\ndef YES():\n\tprint('YES')\n\ndef NO():\n\tprint('NO')\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\nfor _ in range(INT()):\n\tS = input()\n\tN = len(S)\n\tmx = cnt = 0\n\tfor s in S:\n\t\tif s == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tmx = max(mx, cnt)\n\t\t\tcnt = 0\n\tmx = max(mx, cnt)\n\tprint(mx + 1)\n", "t = int(input())\nfor _ in range(t):\n\tsl = list(input())\n\tp = 0\n\tans = 0\n\tfor s in sl:\n\t\tif s == 'L':\n\t\t\tp += 1\n\t\telse:\n\t\t\tans = max(ans, p + 1)\n\t\t\tp = 0\n\telse:\n\t\tans = max(ans, p + 1)\n\tprint(ans)\n", "for _ in range(int(input())):\n\ts = list(input())\n\tmaxle = 0\n\tle = 0\n\tif s[0] == 'L':\n\t\tle = 1\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'L':\n\t\t\tle += 1\n\t\telse:\n\t\t\tif s[i - 1] == 'L' and maxle < le:\n\t\t\t\tmaxle = le\n\t\t\tle = 0\n\tif s[-1] == 'L' and le > maxle:\n\t\tmaxle = le\n\tprint(maxle + 1)\n", "data = input().rstrip().split()\nt = int(data[0])\nfor _ in range(t):\n\ts = input().rstrip().split('R')\n\tprint(max([len(l) for l in s]) + 1)\n", "for q in range(int(input())):\n\ts = input() + 'R'\n\tind = 0\n\tres = 0\n\tx = 0\n\twhile 1:\n\t\tx = s.find('R', x)\n\t\tif x == -1:\n\t\t\tbreak\n\t\telse:\n\t\t\tres = max(x - ind + 1, res)\n\t\t\tx += 1\n\t\t\tind = x\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\tl = list(input())\n\tco_max = 0\n\tco = 1\n\tfor i in range(len(l)):\n\t\tif l[i] == 'R':\n\t\t\tco_max = max(co, co_max)\n\t\t\tco = 1\n\t\telse:\n\t\t\tco += 1\n\tif l[-1] == 'L':\n\t\tif co_max < co:\n\t\t\tco_max = co\n\tprint(co_max)\n", "for _ in range(int(input())):\n\tarr = input()\n\tflagl = 1\n\tmaxx = 1\n\tflag = 0\n\tfor i in range(len(arr)):\n\t\tif arr[i] == 'L':\n\t\t\tflagl += 1\n\t\t\tif flagl > maxx:\n\t\t\t\tmaxx = flagl\n\t\tif arr[i] == 'R':\n\t\t\tflag = 1\n\t\t\tflagl = 1\n\tif flag == 1:\n\t\tprint(maxx)\n\telse:\n\t\tprint(flagl)\n", "t = int(input())\nfor j in range(t):\n\ts = input()\n\tn = len(s)\n\tv = [0]\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tv.append(i + 1)\n\tv.append(n + 1)\n\td = 0\n\tfor i in range(len(v) - 1):\n\t\td = max(d, v[i + 1] - v[i])\n\tprint(d)\n", "for _ in range(int(input())):\n\ts = input()\n\ta = []\n\ts = 'R' + s\n\tshag = 0\n\tfor i in range(len(s) - 1, -1, -1):\n\t\tif s[i] == 'R':\n\t\t\ta.append(shag + 1)\n\t\t\tshag = 0\n\t\telse:\n\t\t\tshag += 1\n\tprint(max(a))\n", "def solve():\n\tS = 'R' + input().strip() + 'R'\n\tprev = 0\n\tmax_dist = 0\n\tfor i in range(1, len(S)):\n\t\tif S[i] == 'R':\n\t\t\tmax_dist = max(max_dist, i - prev)\n\t\t\tprev = i\n\tprint(max_dist)\nt = int(input())\nfor i in range(t):\n\tsolve()\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\ta = s.split('R')\n\tprint(len(max(a)) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tc = 0\n\tMAX = 0\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\t\tMAX = max(c, MAX)\n\tprint(MAX + 1)\n", "from sys import stdin\nT = int(input())\nfor _ in range(T):\n\ts = stdin.readline().split()\n\t(s,) = s\n\tN = len(s)\n\tcurr = 0\n\trights = []\n\tfor char in range(N):\n\t\tif s[char] == 'R':\n\t\t\trights.append(char)\n\tif rights == []:\n\t\tprint(N + 1)\n\t\tcontinue\n\tdists = []\n\tdists.append(rights[0] + 1)\n\tfor i in range(len(rights) - 1):\n\t\tdists.append(rights[i + 1] - rights[i])\n\tdists.append(N - rights[-1])\n\tprint(max(dists))\n", "t = int(input())\nwhile t:\n\ts = input()\n\tprev = -1\n\tm = -1\n\ts += 'R'\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tm = max(i - prev, m)\n\t\t\tprev = i\n\tprint(m)\n\tt -= 1\n", "t = int(input())\nwhile t:\n\ts = input()\n\tans = 0\n\ttemp = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tans = max(ans, temp + 1)\n\t\t\ttemp = 0\n\tans = max(ans, temp + 1)\n\tprint(ans)\n\tt -= 1\n", "for _ in range(int(input())):\n\ts = input()\n\tmn = []\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tmn.append(i + 1)\n\tmn = [0] + mn + [len(s) + 1]\n\tmnd = 0\n\tfor i in range(1, len(mn)):\n\t\tmnd = max(mnd, mn[i] - mn[i - 1])\n\tprint(mnd)\n", "for _ in range(int(input())):\n\ts = input()\n\tn1 = len(s)\n\ts = 'R' + s + 'R'\n\tn = len(s)\n\tl = []\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i)\n\tif len(l) == 2:\n\t\tprint(n1 + 1)\n\telse:\n\t\tc = 0\n\t\tfor i in range(1, len(l)):\n\t\t\tif l[i] - l[i - 1] > c:\n\t\t\t\tc = l[i] - l[i - 1]\n\t\tprint(c)\n", "for _ in range(int(input())):\n\tl = input()\n\ttemp = 0\n\tans = 0\n\tvar = -1\n\tfor i in range(len(l) - 1, -1, -1):\n\t\tif l[i] == 'R':\n\t\t\tvar = i\n\t\t\tbreak\n\tfor i in range(len(l)):\n\t\tif l[i] == 'R':\n\t\t\tans = max(ans, i + 1 - temp)\n\t\t\ttemp = i + 1\n\tans = max(ans, len(l) - var)\n\tprint(ans)\n", "def solve():\n\ts = input()\n\ts = 'R' + s + 'R'\n\tmax_d = -1\n\td1 = -1\n\td2 = -1\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif d1 == -1:\n\t\t\t\td1 = i\n\t\t\telif d2 == -1:\n\t\t\t\td2 = i\n\t\t\t\tif d2 - d1 > max_d:\n\t\t\t\t\tmax_d = d2 - d1\n\t\t\t\td1 = i\n\t\t\t\td2 = -1\n\tprint(max_d)\nfor i in range(int(input())):\n\tsolve()\n", "def solve(level):\n\tll = 0\n\tindex = 0\n\twhile index < len(level):\n\t\tif level[index] == 'R':\n\t\t\tindex += 1\n\t\telse:\n\t\t\tcll = 0\n\t\t\twhile index < len(level) and level[index] != 'R':\n\t\t\t\tcll += 1\n\t\t\t\tindex += 1\n\t\t\tll = max(ll, cll)\n\treturn ll + 1\n\ndef main():\n\tt = int(input())\n\tfor i in range(t):\n\t\td = input()\n\t\tans = solve(d)\n\t\tprint(ans)\nmain()\n", "import sys\ninp = sys.stdin.readline\nans = ''\nfor _ in range(int(inp())):\n\ts = inp()\n\tans += str(max((len(i) for i in s.strip().split('R'))) + 1) + '\\n'\nprint(ans)\n", "a = int(input())\nfor _ in range(a):\n\tb = input()\n\tc = []\n\td = len(b)\n\tmi = 0\n\tfor x in range(d):\n\t\tif b[x] == 'R':\n\t\t\tc.append(x + 1)\n\tc.insert(0, 0)\n\tc.append(d + 1)\n\tfor x in range(len(c) - 1):\n\t\tif c[x + 1] - c[x] > mi:\n\t\t\tmi = c[x + 1] - c[x]\n\tprint(mi)\n", "lines = int(input())\nans = []\nfor i in range(lines):\n\ta = input()\n\tb = []\n\tlong = 1\n\tfor k in range(len(a)):\n\t\tif a[k] == 'R':\n\t\t\tb.append(long)\n\t\t\tlong = 1\n\t\t\tend = k\n\t\telse:\n\t\t\tlong += 1\n\tif b:\n\t\tb.append(len(a) - end)\n\t\tma = max(b)\n\t\tans.append(ma)\n\telse:\n\t\tans.append(long)\nfor i in ans:\n\tprint(i)\n", "t = int(input())\nfor v in range(t):\n\ts = input()\n\tleft = -1\n\tans = 0\n\tl = len(s)\n\tfor i in range(l):\n\t\tif s[i] == 'R':\n\t\t\tans = max(ans, i - left)\n\t\t\tleft = i\n\tans = max(ans, l - left)\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tmaxi = 0\n\tprev = -1\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\tif maxi < i - prev:\n\t\t\t\tmaxi = i - prev\n\t\t\tprev = i\n\tif prev != n - 1:\n\t\tif maxi < n - prev:\n\t\t\tmaxi = n - prev\n\tprint(maxi)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tfor _ in range(int(input())):\n\t\ts = input()\n\t\tdist = 1\n\t\tt = 1\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == 'L':\n\t\t\t\tt += 1\n\t\t\telse:\n\t\t\t\tdist = max(t, dist)\n\t\t\t\tt = 1\n\t\tdist = max(t, dist)\n\t\tprint(dist)\nmain()\n", "from collections import defaultdict, Counter\n\ndef solve(s):\n\ts = ['*'] + list(s)\n\ts.append('R')\n\tx = set()\n\tprev = 0\n\td = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\td = max(d, i - prev)\n\t\t\tprev = i\n\treturn d\nt = int(input(''))\nans = []\nwhile t > 0:\n\tn = input('')\n\tans.append(solve(n))\n\tt -= 1\nfor i in ans:\n\tprint(i)\n", "test = int(input())\nfor i in range(test):\n\tstr_ = input()\n\tstring = list(str_)\n\tn = len(string)\n\tmax_so_far = 0\n\tcurr_so_far = 1\n\tflag = 0\n\tfor i in range(0, n):\n\t\tif i < n - 1 and string[i] == string[i + 1] and (string[i] == 'L'):\n\t\t\tcurr_so_far += 1\n\t\telse:\n\t\t\tif max_so_far < curr_so_far:\n\t\t\t\tmax_so_far = curr_so_far\n\t\t\tcurr_so_far = 1\n\t\tif string[i] == 'L':\n\t\t\tflag = 1\n\tif flag == 0:\n\t\tprint('1')\n\telse:\n\t\tprint(max_so_far + 1)\n", "T = int(input())\nfor _ in range(T):\n\ts = input()\n\tmaximum = 0\n\tflag = -1\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == 'R':\n\t\t\ttemp = i - flag\n\t\t\tflag = i\n\t\t\tif temp > maximum:\n\t\t\t\tmaximum = temp\n\tif n - flag > maximum:\n\t\tmaximum = n - flag\n\tprint(maximum)\n", "t = int(input())\nfor i in range(t):\n\ts = 'R' + input() + 'R'\n\tmax_r = 0\n\tnow_r = 1\n\tfor el in s:\n\t\tif el == 'R':\n\t\t\tmax_r = max(max_r, now_r)\n\t\t\tnow_r = 1\n\t\telse:\n\t\t\tnow_r += 1\n\tprint(max_r)\n", "for i in range(int(input())):\n\ts = input()\n\tmaxi = 1\n\tn = 1\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tn += 1\n\t\telse:\n\t\t\tif maxi < n:\n\t\t\t\tmaxi = n\n\t\t\tn = 1\n\tif maxi < n:\n\t\tmaxi = n\n\tprint(maxi)\n", "def program():\n\ts = input()\n\toverall_max = 1\n\tcurrent_max = 1\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tcurrent_max += 1\n\t\telse:\n\t\t\tif overall_max < current_max:\n\t\t\t\toverall_max = current_max\n\t\t\tcurrent_max = 1\n\tif overall_max < current_max:\n\t\toverall_max = current_max\n\tprint(overall_max)\nt = int(input())\nfor i in range(t):\n\tprogram()\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tsum = 0\n\tss = []\n\tss.append(0)\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tsum += 1\n\t\tif s[j] == 'R' or j == len(s) - 1:\n\t\t\tss.append(sum)\n\t\t\tsum = 0\n\tprint(max(ss) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tn = len(s)\n\tf = 0\n\tans = -1\n\tflag = 0\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tf += 1\n\t\t\tflag = 0\n\t\telse:\n\t\t\tans = max(ans, f)\n\t\t\tf = 0\n\t\t\tflag = 1\n\tif flag == 0:\n\t\tans = max(ans, f)\n\tif ans == -1:\n\t\tprint(n + 1)\n\telse:\n\t\tprint(ans + 1)\n", "n = int(input())\nfor k in range(n):\n\ts = str(input())\n\tarr = s.split('R')\n\tmaxx = 0\n\tfor i in range(len(arr)):\n\t\tif len(arr[i]) > maxx:\n\t\t\tmaxx = len(arr[i])\n\tprint(maxx + 1)\n", "n = int(input())\nfor i in range(0, n):\n\tS = 0\n\ts = input().rstrip()\n\tx = list(s)\n\tW = []\n\tfor j in range(0, len(x)):\n\t\tif x[j] == 'L':\n\t\t\tS += 1\n\t\telse:\n\t\t\tW.append(S)\n\t\t\tS = 0\n\tW.append(S)\n\tprint(max(W) + 1)\n", "t = int(input())\nfor loop in range(t):\n\ts = input()\n\tans = 0\n\tnow = 0\n\tfor i in s:\n\t\tif i == 'R':\n\t\t\tnow = 0\n\t\telse:\n\t\t\tnow += 1\n\t\t\tans = max(ans, now)\n\tprint(ans + 1)\n", "from itertools import groupby\nt = int(input())\nfor _ in range(t):\n\ts = input()\n\ta = [[x, len(list(y))] for (x, y) in groupby(s)]\n\tif len(a) == 0 and a[0][0] == 'L':\n\t\tprint(a[0][1] + 1)\n\tif len(a) == 0 and a[0][0] == 'R':\n\t\tprint(1)\n\telse:\n\t\td = 1\n\t\tfor x in range(len(a)):\n\t\t\tif a[x][0] == 'L':\n\t\t\t\td = max(d, a[x][1] + 1)\n\t\tprint(d)\n", "from sys import stdin\ninput = stdin.readline\n\ndef getAns(s):\n\tlargestGap = 0\n\tlastR = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - lastR > largestGap:\n\t\t\t\tlargestGap = i - lastR\n\t\t\tlastR = i\n\tprint(largestGap)\nn = int(input())\nfor _ in range(n):\n\tgetAns('R' + input().rstrip() + 'R')\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor j in range(t):\n\ts = input().strip().split('R')\n\tprint(max(map(len, s)) + 1)\n", "def solve():\n\ts = input()\n\tn = len(s)\n\tans = 1\n\ti = 0\n\twhile i < n:\n\t\tif s[i] == 'R':\n\t\t\ti += 1\n\t\telse:\n\t\t\tj = i\n\t\t\twhile j < n and s[j] == 'L':\n\t\t\t\tj += 1\n\t\t\tans = max(ans, j - i + 1)\n\t\t\ti = j\n\treturn ans\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tprint(solve())\nmain()\n", "n = int(input())\nfor i in range(n):\n\tjumps = input()\n\tjumps += 'R'\n\tresposta = 1\n\tmaior_dist_r = 0\n\tfor jump in jumps:\n\t\tif jump == 'L':\n\t\t\tmaior_dist_r += 1\n\t\telse:\n\t\t\tmaior_dist_r += 1\n\t\t\tresposta = max(resposta, maior_dist_r)\n\t\t\tmaior_dist_r = 0\n\tif maior_dist_r != 0:\n\t\tresposta = max(resposta, maior_dist_r)\n\tprint(resposta)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\ts = input()[:-1]\n\tl = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tl.append(i + 1)\n\tl.append(len(s) + 1)\n\td = max((l[i + 1] - l[i] for i in range(len(l) - 1)))\n\tprint(d)\n", "q = int(input())\nfor i in range(q):\n\ts = 'L' + input() + 'R'\n\tans = 0\n\tl = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif i - l > ans:\n\t\t\t\tans = i - l\n\t\t\tl = i\n\tprint(ans)\n", "def max_jump(steps):\n\tmax_step = 0\n\tlists = [0]\n\tpointer = 0\n\tfor i in steps:\n\t\tlists.append(i)\n\tlists.append(1)\n\tfor i in range(len(lists)):\n\t\tif lists[i] == 'R' or lists[i] == 1:\n\t\t\tif i - pointer > max_step:\n\t\t\t\tmax_step = i - pointer\n\t\t\tpointer = i\n\treturn max_step\nT = int(input())\nfor _ in range(T):\n\tstep = input()\n\tprint(max_jump(step))\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tlast_r = -1\n\ts_size = len(s)\n\tgreater_jump = 0\n\tfor c in range(s_size):\n\t\tif s[c] == 'R':\n\t\t\tjump = c - last_r\n\t\t\tif jump > greater_jump:\n\t\t\t\tgreater_jump = jump\n\t\t\tlast_r = c\n\tif s_size - last_r > greater_jump:\n\t\tgreater_jump = s_size - last_r\n\tprint(greater_jump)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\t(j, r) = (0, 0)\n\t(dif, tempDif) = (0, 0)\n\twhile j < len(s):\n\t\tif j == 0 and s[j] == 'L':\n\t\t\tj += 1\n\t\t\ttempDif += 1\n\t\t\twhile j < len(s) and s[j] == 'L':\n\t\t\t\tj += 1\n\t\t\t\ttempDif += 1\n\t\t\ttempDif += 1\n\t\t\tif tempDif > dif:\n\t\t\t\tdif = tempDif\n\t\t\ttempDif = 0\n\t\tif j < len(s) and s[j] == 'R':\n\t\t\tj += 1\n\t\t\ttempDif += 1\n\t\t\twhile j < len(s) and s[j] == 'L':\n\t\t\t\ttempDif += 1\n\t\t\t\tj += 1\n\t\t\tif tempDif > dif:\n\t\t\t\tdif = tempDif\n\t\t\ttempDif = 0\n\t\telse:\n\t\t\tj += 1\n\tprint(dif)\n", "t = int(input())\nfor gg in range(t):\n\ts = 'R' + input() + 'R'\n\tlast = 0\n\tmaxx = 0\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tif maxx < i - last:\n\t\t\t\tmaxx = i - last\n\t\t\tlast = i\n\tprint(maxx)\n", "tests = int(input())\n\ndef get_max_left_sequence(string):\n\tmax_count = 0\n\tcount = 0\n\tflag = False\n\tfor i in range(len(string)):\n\t\tif string[i] == 'L' and (not flag):\n\t\t\tflag = True\n\t\telif string[i] == 'R' and flag:\n\t\t\tflag = False\n\t\t\tcount = 0\n\t\tif flag:\n\t\t\tcount += 1\n\t\t\tif count > max_count:\n\t\t\t\tmax_count = count\n\treturn max_count\nfor i in range(tests):\n\tstring = input()\n\tmax_left_sequence = get_max_left_sequence(string)\n\tprint(max_left_sequence + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tc = 0\n\tcm = 0\n\tfor x in s:\n\t\tif x == 'L':\n\t\t\tc += 1\n\t\telse:\n\t\t\tif c > cm:\n\t\t\t\tcm = c\n\t\t\tc = 0\n\tif c > cm:\n\t\tcm = c\n\tprint(cm + 1)\n", "import sys\n\ndef readInt():\n\treturn int(rl())\n\ndef readList():\n\treturn list(map(int, rl().strip().split()))\n\ndef readStr():\n\treturn rl().strip()\n\ndef makeMatrix(a, b, value):\n\tz = [value] * a\n\tfor i in range(a):\n\t\tz[i] = [value] * b\n\treturn z\nrl = input\ntc = readInt()\nwhile tc:\n\ttc -= 1\n\ts = readStr()\n\tn = len(s)\n\tans = 1\n\tk = 1\n\tfor i in range(n):\n\t\tif s[i] == 'L':\n\t\t\tk += 1\n\t\tif s[i] == 'R':\n\t\t\tk = 1\n\t\tans = max(ans, k)\n\tprint(ans)\n", "def frog(S):\n\tn = len(S)\n\tr = 0\n\tl = -1\n\tans = 0\n\twhile r < n:\n\t\twhile r < n and S[r] != 'R':\n\t\t\tr += 1\n\t\tans = max(ans, r - l)\n\t\tl = r\n\t\tr += 1\n\treturn min(ans, n + 1)\nt = int(input())\nfor _ in range(t):\n\tprint(frog(input()))\n", "n = int(input())\nfor i in range(n):\n\tt = input()\n\tt = list(t)\n\tt = t[::-1]\n\tcount = []\n\tr = 0\n\tfor i in t:\n\t\tif i == 'L':\n\t\t\tr += 1\n\t\tif i == 'R':\n\t\t\tcount.append(r)\n\t\t\tr = 0\n\tcount.append(r)\n\tprint(max(count) + 1)\n", "for _ in range(int(input())):\n\ts = input()\n\tk = 1\n\ta = []\n\tfor i in s:\n\t\tif i == 'L':\n\t\t\tk += 1\n\t\telse:\n\t\t\tif k > 0:\n\t\t\t\ta.append(k)\n\t\t\tk = 1\n\tif k > 0:\n\t\ta.append(k)\n\tprint(max(a))\n", "import sys\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\ts = input().strip()\n\t\tn = len(s)\n\t\t(d, is_l) = (0, False)\n\t\t(i, j) = (0, 0)\n\t\twhile i < n:\n\t\t\tif s[i] == 'L':\n\t\t\t\tis_l = True\n\t\t\t\tj = i\n\t\t\t\twhile i < n and s[i] == 'L':\n\t\t\t\t\ti += 1\n\t\t\t\td = max(d, i - j)\n\t\t\ti += 1\n\t\tif is_l:\n\t\t\tprint(d + 1)\n\t\telse:\n\t\t\tprint(1)\nmain()\n", "for t in range(int(input())):\n\ts = input()\n\tx = [-1] + [i for i in range(len(s)) if s[i] == 'R'] + [len(s)]\n\tprint(max([x[i + 1] - x[i] for i in range(len(x) - 1)]))\n", "def process(string):\n\tm = 0\n\tlastIndex = -1\n\tstring += 'R'\n\tfor (i, s) in enumerate(string):\n\t\tif s == 'R':\n\t\t\tm = max(m, i - lastIndex)\n\t\t\tlastIndex = i\n\treturn m\nN = int(input())\nfor n in range(N):\n\ts = input()\n\tprint(process(s))\n", "for _ in range(int(input())):\n\ts = input()\n\ts = 'R' + s + 'R'\n\tprevR = 0\n\tdist = []\n\tfor i in range(1, len(s)):\n\t\tif s[i] == 'R':\n\t\t\tdist.append(i - prevR)\n\t\t\tprevR = i\n\tprint(max(dist))\n", "x = 0\nx += 1\nx = 0\nfor tini in range(int(input())):\n\ts = str(input())\n\tif 'R' not in s:\n\t\tprint(len(s) + 1)\n\telif 'L' not in s:\n\t\tprint('1')\n\telse:\n\t\ta = []\n\t\tfor _ in range(len(s)):\n\t\t\tif s[_] == 'R':\n\t\t\t\ta.append(_)\n\t\tb = []\n\t\tzz = 0\n\t\ttyu = 0\n\t\tfor _ in range(len(a) - 1):\n\t\t\tb.append(a[_ + 1] - a[_])\n\t\tif len(b) > 0:\n\t\t\tprint(max(max(b), max(a[0], len(s) - a[len(a) - 1] - 1) + 1))\n\t\telse:\n\t\t\tprint(max(a[0], len(s) - a[len(a) - 1] - 1) + 1)\n", "from collections import defaultdict\nIA = lambda : map(int, input().split())\nT = int(input())\nfor i in range(0, T):\n\tn = input()\n\tle = len(n)\n\tl = int(0)\n\tpre = 0\n\ti = 0\n\tans = 0\n\tfor it in n:\n\t\ti += 1\n\t\tif it == 'R':\n\t\t\tans = max(ans, i - pre)\n\t\t\tpre = i\n\tans = max(ans, le + 1 - pre)\n\tprint(ans)\n", "n = int(input())\ny = 0\nmin = 0\nfor c in range(n):\n\tb = input()\n\tfor i in range(len(b)):\n\t\tif b[i] == 'L':\n\t\t\ty += 1\n\t\telse:\n\t\t\tif min < y:\n\t\t\t\tmin = y\n\t\t\ty = 0\n\tif y > min:\n\t\tprint(y + 1, '\\n')\n\telse:\n\t\tprint(min + 1, '\\n')\n\tmin = 0\n\ty = 0\n", "t = int(input())\nfor i in range(t):\n\tgrid = input()\n\tls = [0]\n\tfor j in range(len(grid)):\n\t\tif grid[j] == 'R':\n\t\t\tls.append(j + 1)\n\tls.append(len(grid) + 1)\n\tmx = 0\n\tfor j in range(len(ls) - 1):\n\t\tmx = max(mx, ls[j + 1] - ls[j])\n\tprint(mx)\n", "for t in range(int(input())):\n\tarr = input()\n\tarr = 'R' + arr\n\tn = len(arr)\n\td = 0\n\ti = n\n\twhile i >= 0:\n\t\ti -= 1\n\t\tsteps = 0\n\t\twhile arr[i] != 'R':\n\t\t\ti -= 1\n\t\t\tsteps += 1\n\t\tif steps > d:\n\t\t\td = steps\n\tprint(d + 1)\n", "import pdb\nqueries = int(input())\nfor _ in range(queries):\n\tpositions = input()\n\tarray = [0]\n\tfor (index, item) in enumerate(positions):\n\t\tif item == 'R':\n\t\t\tarray.append(index + 1)\n\tarray.append(len(positions) + 1)\n\tif not array:\n\t\tprint(len(positions))\n\telse:\n\t\tmaxValue = 0\n\t\tfor index in range(len(array)):\n\t\t\tif index < len(array) - 1:\n\t\t\t\tmaxValue = max(maxValue, array[index + 1] - array[index])\n\t\tprint(maxValue)\n", "import collections\nlocal = False\nif local:\n\tfile = open('A.txt', 'r')\n\ndef IN():\n\tif local:\n\t\treturn file.readline().rstrip()\n\telse:\n\t\treturn input().rstrip()\n\ndef solve(jumps):\n\tfirst = len(jumps)\n\tlast = -1\n\tfor i in range(len(jumps)):\n\t\tif jumps[i] == 'R':\n\t\t\tfirst = i\n\t\t\tbreak\n\tfor i in range(len(jumps) - 1, -1, -1):\n\t\tif jumps[i] == 'R':\n\t\t\tlast = i\n\t\t\tbreak\n\tans = max(first + 1, len(jumps) - last)\n\tfor i in range(first, len(jumps)):\n\t\tif jumps[i] == 'R':\n\t\t\tans = max(ans, i - first)\n\t\t\tfirst = i\n\treturn ans\nt = int(IN())\nfor i in range(t):\n\tjumps = IN()\n\tprint(solve(jumps))\n", "t = int(input())\nfor i in range(t):\n\t(now, d) = (0, 0)\n\tfor (pos, ch) in enumerate('R' + input() + 'R'):\n\t\tif ch == 'R':\n\t\t\td = max(d, pos - now)\n\t\t\tnow = pos\n\tprint(d)\n", "import math\nt = int(input())\nfor test in range(t):\n\tst = input()\n\tlongest = 1\n\tactual = 1\n\tfor i in range(len(st)):\n\t\tif st[i] == 'L':\n\t\t\tactual += 1\n\t\t\tif actual > longest:\n\t\t\t\tlongest = actual\n\t\telse:\n\t\t\tactual = 1\n\tprint(longest)\n", "n = int(input())\nfor i in range(n):\n\ts = input()\n\tcount = 0\n\tmaxcount = 0\n\tif s.count('L') == len(s):\n\t\tmaxcount = len(s)\n\telif s.count('R') == len(s):\n\t\tmaxcount = 0\n\telse:\n\t\tfor i in s:\n\t\t\tif i == 'L':\n\t\t\t\tcount += 1\n\t\t\telse:\n\t\t\t\tif count > maxcount:\n\t\t\t\t\tmaxcount = count\n\t\t\t\tcount = 0\n\t\tif count > maxcount:\n\t\t\tmaxcount = count\n\tprint(maxcount + 1)\n", "n = int(input())\nfor _ in range(n):\n\ts = input().split('R')\n\tmaxi = 0\n\tfor i in s:\n\t\tif len(i) > maxi:\n\t\t\tmaxi = len(i)\n\tprint(maxi + 1)\n", "import math\nimport itertools\nt = int(input())\nfor i in range(t):\n\ts = input()\n\tmax_cl = 0\n\tprev_pos = None\n\tfor (i, c) in enumerate(s):\n\t\tif c == 'L':\n\t\t\tif prev_pos is None:\n\t\t\t\tprev_pos = i\n\t\telif prev_pos is not None:\n\t\t\tmax_cl = max(max_cl, i - prev_pos)\n\t\t\tprev_pos = None\n\tif prev_pos is not None:\n\t\tmax_cl = max(max_cl, len(s) - prev_pos)\n\tprint(max_cl + 1)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ts = input()\n\tln = len(s)\n\tif len(''.join(set(s))) == 1:\n\t\tif s[0] == 'L':\n\t\t\tprint(ln + 1)\n\t\telse:\n\t\t\tprint(1)\n\telse:\n\t\tmx = -1\n\t\tj = -1\n\t\tfor i in range(ln):\n\t\t\tif s[i] == 'R':\n\t\t\t\tres = i - j\n\t\t\t\tj = i\n\t\t\t\tif mx < res:\n\t\t\t\t\tmx = res\n\t\t\tif i == ln - 1:\n\t\t\t\tres = ln - j\n\t\t\t\tif res > mx:\n\t\t\t\t\tmx = res\n\t\tprint(mx)\n", "import math\nq = int(input())\nfor _ in range(q):\n\ts = list(input())\n\tn = len(s)\n\tmaxx = 0\n\tk = 0\n\tfor i in range(n):\n\t\tif i == 0 and s[i] == 'L':\n\t\t\tk += 1\n\t\telif s[i] == 'L' and s[i - 1] == 'L':\n\t\t\tk += 1\n\t\telif s[i] == 'L' and s[i - 1] == 'R':\n\t\t\tk += 1\n\t\telse:\n\t\t\tmaxx = max(maxx, k)\n\t\t\tk = 0\n\tmaxx = max(maxx, k)\n\tprint(maxx + 1)\n", "t = int(input())\nfor i in range(t):\n\ta = 0\n\tb = []\n\ts = input()\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\ta += 1\n\t\telse:\n\t\t\tb.append(a)\n\t\t\ta = 0\n\tb.append(a)\n\tb.sort()\n\tprint(b[len(b) - 1] + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tl = []\n\tprev = s.find('R')\n\tif prev == -1:\n\t\tprint(n + 1)\n\telse:\n\t\tl.append(prev + 1)\n\t\tstart = prev\n\t\tfor i in range(start, n):\n\t\t\tif s[i] == 'R':\n\t\t\t\tl.append(i - prev)\n\t\t\t\tprev = i\n\t\tl.append(n - prev)\n\t\tprint(max(l))\n", "t = int(input())\nfor i in range(t):\n\tstring = input()\n\ta = []\n\ta.append(0)\n\tfor i in range(len(string)):\n\t\tif string[i] == 'R':\n\t\t\ta.append(i + 1)\n\ta.append(len(string) + 1)\n\tmax = 0\n\tfor i in range(len(a) - 1):\n\t\tif a[i + 1] - a[i] > max:\n\t\t\tmax = a[i + 1] - a[i]\n\tprint(max)\n", "for _ in range(int(input())):\n\ts = input()\n\tg = [0]\n\tfor i in range(len(s)):\n\t\tif s[i] == 'R':\n\t\t\tg.append(i + 1)\n\tg.append(len(s) + 1)\n\tm = 1\n\tfor i in range(len(g) - 1):\n\t\tm = max(m, g[i + 1] - g[i])\n\tprint(m)\n", "T = int(input())\nfor t in range(T):\n\tS = 'R' + input() + 'R'\n\tcount = 1\n\tA = []\n\tfor s in S:\n\t\tif s == 'R':\n\t\t\tA.append(count)\n\t\t\tcount = 1\n\t\telse:\n\t\t\tcount += 1\n\tprint(max(A))\n", "t = int(input())\nfor i in range(t):\n\tstrs = 'R' + input() + 'R'\n\tmx_len = 0\n\tprev_idx = 0\n\tfor (i, s) in enumerate(strs):\n\t\tif i == 0:\n\t\t\tcontinue\n\t\tif s == 'R':\n\t\t\tr_len = i - prev_idx\n\t\t\tprev_idx = i\n\t\t\tif r_len > mx_len:\n\t\t\t\tmx_len = r_len\n\tprint(mx_len)\n", "import math\nn = int(input())\nfor t in range(n):\n\ta = list(input())\n\tmaior = 1\n\taux = 1\n\tfor i in a:\n\t\tif i == 'L':\n\t\t\taux += 1\n\t\telif aux > maior:\n\t\t\tmaior = aux\n\t\t\taux = 1\n\t\telse:\n\t\t\taux = 1\n\tif aux > maior:\n\t\tmaior = aux\n\tprint(maior)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tl = list(input())\n\tn = len(l)\n\ti = 0\n\tj = 0\n\tma = 0\n\tc = 0\n\twhile i < len(l):\n\t\tif l[i] == 'L':\n\t\t\tc += 1\n\t\tif i + 1 < n and l[i + 1] != 'L':\n\t\t\tif c > ma:\n\t\t\t\tma = c\n\t\t\tc = 0\n\t\ti += 1\n\tif c > ma:\n\t\tma = c\n\tprint(ma + 1)\n", "t = int(input())\nfor tt in range(t):\n\ts = input()\n\ti = 0\n\tp1 = i\n\tp2 = p1\n\ttamanho = []\n\twhile i < len(s):\n\t\tif s[p2] == 'R' or p2 == len(s) - 1:\n\t\t\tif s[p2] == 'L':\n\t\t\t\tp2 += 1\n\t\t\ttamanho.append(p2 - p1 + 1)\n\t\t\tp1 = p2 + 1\n\t\t\tp2 = p1\n\t\telse:\n\t\t\tp2 += 1\n\t\ti += 1\n\tprint(max(tamanho))\n", "for _ in range(int(input())):\n\tst = input()\n\tarr = [0]\n\tfor i in range(len(st)):\n\t\tif st[i] == 'R':\n\t\t\tarr.append(i + 1)\n\tarr.append(len(st) + 1)\n\tmaxdiff = 0\n\tfor j in range(len(arr) - 1):\n\t\tdiff = arr[j + 1] - arr[j]\n\t\tmaxdiff = diff if diff > maxdiff else maxdiff\n\tprint(maxdiff)\n", "import sys, re\ntc = int(sys.stdin.readline())\nfor _ in range(tc):\n\tarr = list(sys.stdin.readline().rstrip())\n\ttemp = []\n\tcnt = 0\n\tfor i in arr:\n\t\tif i == 'L':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\ttemp.append(cnt)\n\t\t\tcnt = 0\n\ttemp.append(cnt)\n\tprint(max(temp) + 1)\n", "n = int(input())\ns = []\nfor i in range(n):\n\tl = input()\n\ts.append(l)\nfor i in range(n):\n\tp = 0\n\tcha = 0\n\tzi_ = []\n\tcl = []\n\tfor j in s[i]:\n\t\tcl.append(j)\n\tfor i in range(len(cl)):\n\t\tif cl[i] == 'R':\n\t\t\tcha = i + 1 - p\n\t\t\tp = i + 1\n\t\t\tzi_.append(cha)\n\tlast = len(cl) + 1 - p\n\tif zi_ == []:\n\t\tprint(len(cl) + 1)\n\telif max(zi_) >= last:\n\t\tprint(max(zi_))\n\telif max(zi_) < last:\n\t\tprint(last)\n", "for i in range(int(input())):\n\tseq = input()\n\tcount = set()\n\ttemp = 0\n\tfor j in seq:\n\t\tif j == 'L':\n\t\t\ttemp += 1\n\t\telse:\n\t\t\tcount.add(temp)\n\t\t\ttemp = 0\n\tcount.add(temp)\n\tprint(str(max(count) + 1))\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\tdistancia = 1\n\tminimo = 0\n\tfor d in s:\n\t\tif d != 'R':\n\t\t\tdistancia += 1\n\t\telse:\n\t\t\tminimo = max(minimo, distancia)\n\t\t\tdistancia = 1\n\tminimo = max(minimo, distancia)\n\tdistancia = 1\n\tprint(minimo)\n", "for _ in range(int(input())):\n\ta = input()\n\tif 'R' not in a:\n\t\tprint(len(a) + 1)\n\t\tcontinue\n\tmx = 0\n\ttc = -1\n\ta += 'R'\n\tn = len(a)\n\tfor i in range(n):\n\t\tif a[i] == 'R':\n\t\t\tmx = max(mx, i - tc)\n\t\t\ttc = i\n\tprint(mx)\n", "def d_min(seq):\n\tdestination = len(seq)\n\tpossible = [-1]\n\tfor (i, pos) in enumerate(seq):\n\t\tif pos == 'R':\n\t\t\tpossible.append(i)\n\tpossible.append(destination)\n\tcurr = 0\n\tfor (i, _) in enumerate(possible[1:], start=1):\n\t\tif curr < possible[i] - possible[i - 1]:\n\t\t\tcurr = possible[i] - possible[i - 1]\n\tdel possible\n\tprint(curr)\nfor _ in range(int(input())):\n\td_min(list(input()))\n", "def solve():\n\tans = 0\n\ts = 'R' + input() + 'R'\n\tarr = [i for i in range(len(s)) if s[i] == 'R']\n\tfor i in range(len(arr) - 1):\n\t\tans = max(ans, arr[i + 1] - arr[i])\n\treturn ans\nt = int(input())\nfor _ in range(t):\n\tprint(solve())\n", "t = int(input())\nfor i in range(t):\n\ta = list(input())\n\tk = [0]\n\tfor i in range(len(a)):\n\t\tif a[i] == 'R':\n\t\t\tk.append(i + 1)\n\tk.append(len(a) + 1)\n\ty = []\n\tfor j in range(len(k) - 1):\n\t\ty.append(k[j + 1] - k[j])\n\tprint(max(y))\n", "tests = int(input())\nfor _ in range(tests):\n\tjumps = input()\n\tn = len(jumps)\n\tindices = [0]\n\tdists = []\n\tfor i in range(n):\n\t\tif jumps[i] == 'R':\n\t\t\tindices.append(i + 1)\n\t\t\tdists.append(i - indices[-2] + 1)\n\tdists.append(n - indices[-1] + 1)\n\tprint(max(dists))\n", "t = int(input())\n\ndef reverse(string):\n\tstring = ''.join(reversed(string))\n\treturn string\nwhile t != 0:\n\tl = input()\n\tr_l = reverse(l)\n\tk = []\n\tfirst = 0\n\ts = 0\n\tflag = 0\n\tlast = 0\n\tfor i in range(len(r_l)):\n\t\tif r_l[i] == 'R':\n\t\t\tk.append(i + 1)\n\t\t\tbreak\n\tfor i in range(len(l)):\n\t\tif first == 0 and l[i] == 'R':\n\t\t\tk.append(i + 1)\n\t\t\ts = i\n\t\t\tflag = 1\n\t\t\tfirst = 1\n\t\telif l[i] == 'R':\n\t\t\tk.append(i - s)\n\t\t\ts = i\n\tif flag == 0:\n\t\tprint(len(l) + 1)\n\telse:\n\t\tprint(max(k))\n\tt -= 1\n", "for t in range(int(input())):\n\tarr = list(map(str, input().split('R')))\n\tans = []\n\tfor x in arr:\n\t\tans.append(len(x))\n\tprint(max(ans) + 1)\n", "t = int(input())\nfor _ in range(t):\n\ts = input()\n\tn = len(s)\n\tcount = []\n\ttemp = 1\n\tflag = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == s[i + 1] and s[i] == 'L':\n\t\t\tflag = 1\n\t\t\ttemp += 1\n\t\telif flag:\n\t\t\tcount.append(temp)\n\t\t\ttemp = 1\n\t\t\tflag = 0\n\t\telif s[i] == 'L':\n\t\t\tcount.append(temp)\n\tif flag or s[-1] == 'L':\n\t\tcount.append(temp)\n\tif len(count) == 0:\n\t\tif n == 1:\n\t\t\tif s[0] == 'L':\n\t\t\t\tprint(2)\n\t\t\telse:\n\t\t\t\tprint(1)\n\t\telse:\n\t\t\tprint(1)\n\telse:\n\t\tprint(max(count) + 1)\n", "from collections import deque\ntc = int(input())\nfor _ in range(tc):\n\tarr = deque(input())\n\tlis = [0]\n\tfor q in range(len(arr)):\n\t\tif arr[q] == 'R':\n\t\t\tlis.append(q + 1)\n\tlis.append(len(arr) + 1)\n\tdist = 0\n\tfor k in range(0, len(lis) - 1):\n\t\tdist = max(dist, lis[k + 1] - lis[k])\n\tprint(dist)\n", "for _ in range(int(input())):\n\tS = input()\n\tN = len(S)\n\t(cnt, ans) = (0, 0)\n\tflag = False\n\tfor i in range(N):\n\t\tif S[i] == 'L':\n\t\t\tif flag:\n\t\t\t\tcnt += 1\n\t\t\telse:\n\t\t\t\tcnt = 1\n\t\t\t\tflag = True\n\t\t\tans = max(ans, cnt)\n\t\telse:\n\t\t\tflag = False\n\tprint(ans + 1)\n", "t = int(input())\nfor i in range(t):\n\ts = input()\n\th = 0\n\tg = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == 'L':\n\t\t\tif j == len(s) - 1:\n\t\t\t\th += 1\n\t\t\t\tg = max(g, h)\n\t\t\telse:\n\t\t\t\th += 1\n\t\telse:\n\t\t\tg = max(g, h)\n\t\t\th = 0\n\tprint(g + 1)\n"]

difficulty: EASY

source: codeforces

sample_tests: {"inputs": ["6\nLRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR"], "outputs": ["3\n2\n3\n1\n7\n1"]}

raw_problem:
C. Frog Jumps

time limit per test
2 seconds

memory limit per test
256 megabytes

input
standard input

output
standard output

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:

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.

question:
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](1.png)
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.

tags: ['Graph traversal', 'Sorting', 'Implementation', 'Greedy algorithms', 'Data structures']

skill_types: ['Sorting', 'Data structures', 'Greedy algorithms']

raw_tags: ['data structures', 'greedy', 'implementation', 'dfs and similar', 'binary search']

data_split: test