#abc229g. [abc229_g]Longest Y
[abc229_g]Longest Y
Problem Statement
Given is a string consisting of Y
and .
.
You can do the following operation on between and times (inclusive).
- Swap two adjacent characters in .
What is the maximum possible number of consecutive Y
s in after the operations?
Constraints
- Each character of is
Y
or.
. - is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
YY...Y.Y.Y.
2
Sample Output 1
3
After swapping the -th, -th characters, and -th, -th characters, we have YY....YYY..
, which has three consecutive Y
s at -th through -th positions.
We cannot have four or more consecutive Y
s, so the answer is .
Sample Input 2
YYYY....YYY
3
Sample Output 2
4