Sunny Days | 프로그래밍의 벗 PivotOJ
PivotOJ

Sunny Days

시간 제한: 1000ms메모리 제한: 2048MB출처: CCC 2025 JuniorBOJ 34457

문제

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, NN, representing the number of days in the historical data. The following NN 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, MM, which is the maximum possible number of consecutive days with sunshine.

예제

예제 1

입력
8
P
S
P
S
S
P
P
S
출력
4
코드를 제출하려면 로그인하세요.