Logo
(追記) (追記ここまで)

34457번 - Sunny Days 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB50231944.186%

문제

There is a large amount of historical weather data for CEMCity. Each day in the data is listed as either a day with sunshine or a day with precipitation. Jeremy is interested in finding the record for the most consecutive days with sunshine. Unfortunately, the data is incorrect for exactly one day, but Jeremy doesn’t know which day this is.

Your job is to help Jeremy determine the maximum possible number of consecutive days with sunshine.

입력

The first line of input contains a positive integer, $N,ドル representing the number of days in the historical data. The following $N$ lines each contain either the character S or the character P, representing a day with sunshine or a day with precipitation, respectively, in chronological order.

출력

Output the non-negative integer, $M,ドル which is the maximum possible number of consecutive days with sunshine.

제한

  • $N ≤ 500,円 000$

예제 입력 1

8
P
S
P
S
S
P
P
S

예제 출력 1

4

If the data is incorrect for the third day, then there was sunshine from the second day to the fifth day which is four consecutive days with sunshine. This is the maximum possible number of consecutive days with sunshine. That is, no matter which day the data is incorrect for, there were not five (or more) consecutive days of sunshine.

노트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2025 > CCC 2025 Junior Division 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /