| SanSi Cup 2026 Qualification round |
|---|
| Finished |
After a lot of insisting, Cindy convinced Samir to train together for the SanSi Cup. Their coach, Joaquín Morales, sent them a list of $$$n$$$ problems, and both try each one very carefully: Joaquín promised a special prize to whoever has the longest streak of Accepteds.
Each of them got one verdict per problem, in the order of the list: A (Accepted), W (Wrong Answer) or T (Time Limit Exceeded). A streak of Accepteds is a stretch of consecutive problems with verdict A.
If Cindy's longest streak is longer than Samir's, Cindy wins. If it is the other way around, Samir wins. If both have the same length, nobody gets the prize. Who wins?
The first line contains an integer $$$t$$$, the number of test cases.
Each case has three lines:
Each letter is A, W or T.
Constraints
For each case, print on one line C if Cindy wins, S if Samir wins, or F if nobody gets the prize.
3 6 AAWAAA AATAAW 4 WATA AAWT 3 WTW TTW
C S F
2 5 AWAWA AATWW 5 TAAWA AAWAA
S F
Example 1. In the first case, Cindy's longest streak is the last three problems and Samir's has length $$$2$$$. In the second, Cindy has streaks of length $$$1$$$ and Samir one of length $$$2$$$. In the third, neither has any Accepted: both streaks have length $$$0$$$.
Example 2. In the first case, Cindy has three Accepteds, but none right after another, so her longest streak has length $$$1$$$. Samir's has length $$$2$$$. In the second, both longest streaks have length $$$2$$$.
| Name |
|---|


