33OJ
登录 注册

B. 最长连续雨天 / Longest Rainy Streak

    传统题 1000ms 256MiB

最长连续雨天 / Longest Rainy Streak

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Statement

Takahashi recorded the weather for NN consecutive days, recording each day as "sunny" or "rainy". His record is given as a string SS of length NN in the following format.

  • The ii-th character ( 1≤i≤N1 \le i \le N ) of SS represents the weather on the ii-th day from the start of the record.
    • If the ii-th character of SS is S, the record for that day was "sunny".
    • If the ii-th character of SS is R, the record for that day was "rainy".

Find the maximum number of consecutive days for which Takahashi recorded "rainy". If Takahashi never recorded "rainy", the answer is 00.

Constraints

  • NN is an integer satisfying 1≤N≤1001 \le N \le 100.
  • SS is a string of length NN consisting of S and R.

Input

The input is given from Standard Input in the following format:

  • NN
  • SS

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 4,5,64,5,6, and there is no longer consecutive run of "rainy", so the maximum number of consecutive days with "rainy" recorded is 33.

10
SSSSSSSSSS
0

Takahashi never recorded "rainy". In this case, the answer is 00.

20
RRRSRRRRSSRRRRSRSRRR
4

ABC479 赛后模拟赛 ✅️

未参加
状态
已结束
规则
IOI
题目
7
开始于
2026-10-17 21:40
结束于
2026-10-31 21:40
持续时间
336 小时
主持人
参赛人数
55