#agc055b. [agc055_b]ABC Supremacy
[agc055_b]ABC Supremacy
Problem Statement
You are given a string of length , consisting of A
, B
, and C
. You are allowed to perform the following operation any number of times:
- Choose any with , such that is equal to
ABC
,BCA
, orCAB
. Then, replace the three characters withABC
,BCA
, orCAB
.
For example, you can perform the following transformations with string AABC
:
AABC
ABCA
BCAA
Determine if you can obtain string from string with some finite (maybe zero) number of operations above.
Constraints
- is a string of length consisting of
A
,B
, andC
. - is a string of length consisting of
A
,B
, andC
.
Input
Input is given from Standard Input in the following format:
Output
If you can transform into with the operations above, output YES
, otherwise output NO
. The checker is case-insensitive: you can use either uppercase or lowercase letters.
Sample Input 1
4
AABC
BCAA
Sample Output 1
YES
This example was explained in the statement.
Sample Input 2
4
ABCA
BCAB
Sample Output 2
NO