#R229G. [ABC229G] Longest Y
[ABC229G] Longest Y
Score : points
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 Ys in after the operations?
Constraints
- Each character of is
Yor.. - is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
YY...Y.Y.Y.
2
3
After swapping the -th, -th characters, and -th, -th characters, we have YY....YYY.., which has three consecutive Ys at -th through -th positions.
We cannot have four or more consecutive Ys, so the answer is .
YYYY....YYY
3
4