欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1324C.Frog Jumps
Frog Jumps
There is a frog staying to the left of the string consisting of characters (to be more precise, the frog initially stays at the cell ). Each character of is either 'L' or 'R'. It means that if the frog is staying at the -th cell and the -th character is 'L', the frog can jump only to the left. If the frog is staying at the -th cell and the -th character is 'R', the frog can jump only to the right. The frog can jump only to the right from the cell .
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 -th cell. The frog chooses some positive integer value before the first jump (and cannot change it later) and jumps by no more than cells at once. I.e. if the -th character is 'L' then the frog can jump to any cell in a range , and if the -th character is 'R' then the frog can jump to any cell in a range .
The frog doesn't want to jump far, so your task is to find the minimum possible value of such that the frog can reach the cell from the cell if it can jump by no more than cells at once. It is guaranteed that it is always possible to reach from .
You have to answer independent test cases.
Input
The first line of the input contains one integer () — the number of test cases.
The next lines describe test cases. The -th test case is described as a string consisting of at least and at most characters 'L' and 'R'.
It is guaranteed that the sum of lengths of strings over all test cases does not exceed ().
Output
For each test case, print the answer — the minimum possible value of such that the frog can reach the cell from the cell if it jumps by no more than at once.
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 to .
In the third test case of the example, the frog can choose , jump to the cell from the cell and then to the cell from the cell .
In the fourth test case of the example, the frog can choose and jump times to the right.
In the fifth test case of the example, the frog can only jump directly from to .
In the sixth test case of the example, the frog can choose and jump times to the right.
Samples
6
LRLRRLL
L
LLR
RRRR
LLLLLL
R
3
2
3
1
7
1
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |