{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere is a frog staying to the left of the string $$$s \u003d 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 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 or \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027. It means that if the frog is staying at the $$$i$$$-th cell and the $$$i$$$-th character is \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027, the frog can jump only to the left. If the frog is staying at the $$$i$$$-th cell and the $$$i$$$-th character is \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027, the frog can jump only to the right. \u003cspan class\u003d\"tex-font-style-bf\"\u003eThe frog can jump only to the right from the cell $$$0$$$\u003c/span\u003e.\u003c/p\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003eNote that the frog can jump into the same cell twice and can perform as many jumps as it needs\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eThe frog wants to reach the $$$n+1$$$-th cell. The frog chooses some \u003cspan class\u003d\"tex-font-style-bf\"\u003epositive integer\u003c/span\u003e value $$$d$$$ \u003cspan class\u003d\"tex-font-style-bf\"\u003ebefore the first jump\u003c/span\u003e (and cannot change it later) and jumps by no more than $$$d$$$ cells at once. I.e. if the $$$i$$$-th character is \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 then the frog can jump to any cell in a range $$$[max(0, i - d); i - 1]$$$, and if the $$$i$$$-th character is \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027 then the frog can jump to any cell in a range $$$[i + 1; min(n + 1; i + d)]$$$.\u003c/p\u003e\u003cp\u003eThe frog doesn\u0027t 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. \u003cspan class\u003d\"tex-font-style-bf\"\u003eIt is guaranteed that it is always possible to reach $$$n+1$$$ from $$$0$$$\u003c/span\u003e.\u003c/p\u003e\u003cp\u003eYou have to answer $$$t$$$ independent test cases.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eThe 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 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 and \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027.\u003c/p\u003e\u003cp\u003eIt 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$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor 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.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\nLRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n2\n3\n1\n7\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe picture describing the first test case of the example and one of the possible answers:\u003c/p\u003e\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/82e72044207a7f5055c1cc150d3699b1?v\u003d1716184698\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\u003cp\u003eIn the second test case of the example, the frog can only jump directly from $$$0$$$ to $$$n+1$$$.\u003c/p\u003e\u003cp\u003eIn the third test case of the example, the frog can choose $$$d\u003d3$$$, jump to the cell $$$3$$$ from the cell $$$0$$$ and then to the cell $$$4$$$ from the cell $$$3$$$.\u003c/p\u003e\u003cp\u003eIn the fourth test case of the example, the frog can choose $$$d\u003d1$$$ and jump $$$5$$$ times to the right.\u003c/p\u003e\u003cp\u003eIn the fifth test case of the example, the frog can only jump directly from $$$0$$$ to $$$n+1$$$.\u003c/p\u003e\u003cp\u003eIn the sixth test case of the example, the frog can choose $$$d\u003d1$$$ and jump $$$2$$$ times to the right.\u003c/p\u003e"}}]}