#ABC479B. 最长连续雨天 / Longest Rainy Streak
最长连续雨天 / Longest Rainy Streak
Problem Statement
Takahashi recorded the weather for consecutive days, recording each day as "sunny" or "rainy". His record is given as a string of length in the following format.
- The -th character ( ) of represents the weather on the -th day from the start of the record.
- If the -th character of is
S, the record for that day was "sunny". - If the -th character of is
R, the record for that day was "rainy".
- If the -th character of is
Find the maximum number of consecutive days for which Takahashi recorded "rainy". If Takahashi never recorded "rainy", the answer is .
Constraints
- is an integer satisfying .
- is a string of length consisting of
SandR.
Input
The input is given from Standard Input in the following format:
Output
Output the answer.
7
RRSRRRS
3
Starting from the first day, Takahashi recorded rainy, rainy, sunny, rainy, rainy, rainy, sunny. "Rainy" was recorded consecutively on days , and there is no longer consecutive run of "rainy", so the maximum number of consecutive days with "rainy" recorded is .
10
SSSSSSSSSS
0
Takahashi never recorded "rainy". In this case, the answer is .
20
RRRSRRRRSSRRRRSRSRRR
4
- Source: AtCoder ABC 479 B
相关
在下列比赛中: