{"trustable":false,"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\u003e有一只蛙蛙在字符串s左边,也就是下标为 $$$0$$$ 的位置,字符串 $$$s \u003d s_1 s_2 \\ldots s_n$$$ 由 $$$n$$$ 个字母构成。每个字母都是 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 或 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027. 如果蛙蛙在 $$$i$$$ 号位置并且 $$$i$$$ 号位置的字母是 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027, 那么蛙蛙只能向左边跳,反之如果是 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027那么蛙蛙只能向右边跳. \u003cspan class\u003d\"tex-font-style-bf\"\u003e蛙蛙在 $$$0$$$ 号位置的时候只能向右跳\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cspan class\u003d\"tex-font-style-bf\"\u003e蛙蛙可以多次跳进同一个位置,也可以无限次数跳跃\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003e蛙蛙想要到达 $$$n+1$$$ 号位置. 蛙蛙可以选择一个 \u003cspan class\u003d\"tex-font-style-bf\"\u003e正整数\u003c/span\u003e $$$d$$$ \u003cspan class\u003d\"tex-font-style-bf\"\u003e在最初的时候\u003c/span\u003e (之后不能更改) 然后每一次跳跃不能超过 $$$d$$$ 个位置若 $$$i$$$号位置的字母是 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 那么蛙蛙可以从 i 号位置跳到 $$$[max(0, i - d); i - 1]$$$ 范围中的任意一个位置, 反之若 $$$i$$$号位置的字母是\u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027 那么蛙蛙可以从 i 号位置跳到 $$$[i + 1; min(n + 1; i + d)]$$$ 范围中的任意一个位置.\u003c/p\u003e\n\u003cp\u003e蛙蛙不想一次跳太远,那样很累,所以他想请你找到可以从 0 号位置一直跳跃,能达到 n+1 号位置的一个最小的 $$$d$$$ 是多少 。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e第一行一个整数 $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — 表示测试数据组数。\u003c/p\u003e\n\u003cp\u003e接下来 $$$t$$$ 行每行一个字符串组成,长度范围是 $$$1$$$ 到 $$$2 \\cdot 10^5$$$ ,由字母 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eL\u003c/span\u003e\u0027 和 \u0027\u003cspan class\u003d\"tex-font-style-tt\"\u003eR\u003c/span\u003e\u0027组成.\u003c/p\u003e\n\u003cp\u003e保证所有数据字符串总长度不超过 $$$2 \\cdot 10^5$$$ ($$$\\sum |s| \\le 2 \\cdot 10^5$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e对于每一个测试数据,输出一个答案 — 符合条件的最小值 $$$d$$$ .\u003c/p\u003e"}},{"title":"Sample 1","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\u003e图片表示了第一个测试数据的答案解释:\u003c/p\u003e\n\u003cp\u003e\u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/82e72044207a7f5055c1cc150d3699b1?v\u003d1670066885\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e\u003c/p\u003e\n\u003cp\u003e第二个和第五个测试数据中,蛙蛙只能直接从 $$$0$$$ 跳到 $$$n+1$$$.\u003c/p\u003e\n"}}]}