Sunny Days
면접 대비시간 제한1초메모리 제한2048 MB
S와 P로 이루어진 날씨 기록에서 정확히 하루가 잘못되었다고 할 때, 가능한 가장 긴 연속 S 구간의 길이를 구한다.
문제
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, , representing the number of days in the historical data. The following 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, , which is the maximum possible number of consecutive days with sunshine.