P3105 [USACO14OPEN] Fair Photography S

Description

FJ's N cows (2

Input Format

\* Line 1: The integer N. \* Lines 2..1+N: Line i+1 contains x\_i and either W (for a white cow) or S (for a spotted cow).

Output Format

\* Line 1: The maximum size of a fair photo FJ can take, after possibly painting some of his white cows to make them spotted.

Explanation/Hint

There are 5 cows. One of them is a white cow at position 8, and so on. FJ takes a photo of the cows from positions 3 to positions 10. There are 4 cows in this range -- 3 white and 1 spotted -- so he needs to paint one of the white cows to make it spotted.