atcoder#ABC296A. [ABC296A] Alternately
[ABC296A] Alternately
Score : points
Problem Statement
There is a row of people. They are described by a string of length . The -th person from the front is male if the -th character of is M
, and female if it is F
.
Determine whether the men and women are alternating.
It is said that the men and women are alternating if and only if there is no position where two men or two women are adjacent.
Constraints
- is an integer.
- is a string of length consisting of
M
andF
.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if the men and women are alternating, and No
otherwise.
6
MFMFMF
Yes
There is no position where two men or two women are adjacent, so the men and women are alternating.
9
FMFMMFMFM
No
1
F
Yes