#P11076. 「FSLOI Round I」单挑
「FSLOI Round I」单挑
Description
Exactly one of FL_sleake and SnowTrace will win a single one-on-one round. There is no situation of a tie.
Due to the uneven strength between FL_sleake and SnowTrace, they have made the rules as follow:
Given two positive integers and . If FL_sleake wins rounds before SnowTrace wins rounds, FL_sleake wins. Otherwise SnowTrace wins.
There have already been one-on-one rounds, and their results is given as a string of length . If the -th character of is F, it means FL_sleake has won the -th round. If the -th character of is S, it means SnowTrace has won the -th round.
FL_sleake wants to find the minimum number of the maximum winning streak in the following rounds of himself if he wins at last.
Input Format
Each test contains test cases.
The first line contains a single integer — the number of test cases. The description of test cases follows.
The first line of each test case contains three integers and .
The second line of each test case contains the string of length .
Output Format
For each test case, output one line containing a single integer, which is the answer of the test case.
1
5 6 4
SFSFS
4
1
3 7 3
FFF
2
1
29 1000 20
FFFSFFFFSFFFFFSFFFSFFFFFFSFFF
66
Hint
Example Explanation
In the first example, in order for FL_sleake to win, he must win all of the following rounds until he wins a total of rounds. So, he has to win times in a row.
In the second example, is a possible result of the following rounds. In this case, the maximum winning streak of FL_sleake is .
Note that you only needs to consider the maximum winning streak in the following rounds until he wins. The streak in the first rounds doesn't matter.
Constraints
Subtasks are used in this problem.
For all tests, it is guaranteed that:
- ,SnowTrace doesn't win after the -th round.
- ,FL_sleake doesn't win after the -th round.
| Subtask Id | Score | Special Property |
|---|---|---|
| - |
- Special property : SnowTrace wins rounds after the -th round.
京公网安备 11011102002149号