P24489 [AtCoder] Alternately
入门
题目描述

Problem Statement

There is a row of N people. They are described by a string S of length N. The i-th person from the front is male if the i-th character of S 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.

Input

The input is given from Standard Input in the following format:
N
S

Output

Print Yes if the men and women are alternating, and No otherwise.

Constraints

  • $1 \leq N \leq 100$
  • N is an integer.
  • S is a string of length N consisting of M and F.

Sample Input 1

6
MFMFMF

Sample Output 1

Yes

There is no position where two men or two women are adjacent, so the men and women are alternating.

Sample Input 2

9
FMFMMFMFM

Sample Output 2

No

Sample Input 3

1
F

Sample Output 3

Yes

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 MFMFMF
样例输出
Yes