#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

bool solve(string s){
    if(s.length()<=3){
        return s=="ABC";
    }
    string s1,s2,s3;
    bool f[3]={};
    rep(i,s.length()){
        if(i<s.length()-2){
            if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
                s1+="A",s2+="B",s3+="C";
                i+=2;
            }
            else{
                s1+=s[i],s2+=s[i],s3+=s[i],f[s[i]-'A']=true;
            }
        }
        else{
            s1+=s[i],s2+=s[i],s3+=s[i],f[s[i]-'A']=true;
        }
    }
    if(s!=s1){
        bool ret=false;
        if(!f[0])ret|=solve(s1);
        if(!f[1])ret|=solve(s2);
        if(!f[2])ret|=solve(s3);
        return ret;
    }
    return false;
}

void run(){
    string s;
    cin>>s;
    Yes(solve(s));
}

### Prompt

In CPP, your task is to solve the following problem:

ABC Gene

There is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by performing the following operations several times.

* Choose one of the letters `A`,` B`, `C`. Let this be x. Replace all x in the gene sequence with `ABC` at the same time.



Given a string S consisting only of `A`,` B`, and `C`. Determine if the gene sequence can be matched to S.

Constraints

* 1 ≤ | S | ≤ 5,000
* S consists only of `A`,` B`, and `C`.



Input Format

Input is given from standard input in the following format.


S


Output Format

Output `Yes` if the gene sequence can be matched to S, and` No` if it cannot be matched.

Sample Input 1


ABC


Sample Output 1


Yes


The gene sequence is `ABC` from the beginning.

Sample Input 2


AABCC


Sample Output 2


Yes


If you select `B` and perform the operation, it becomes` ABC` → `AABCC`.

Sample Input 3


AABCABC


Sample Output 3


No


For example, even if you select `C` and perform an operation, it does not change from` AABCC` to `AABCABC`. Since all `C`s are replaced with` ABC` at the same time, the actual result is `AABCC` →` AABABCABC`.





Example

Input

ABC


Output

Yes

### Response

```cpp
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
// #define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

bool solve(string s){
    if(s.length()<=3){
        return s=="ABC";
    }
    string s1,s2,s3;
    bool f[3]={};
    rep(i,s.length()){
        if(i<s.length()-2){
            if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
                s1+="A",s2+="B",s3+="C";
                i+=2;
            }
            else{
                s1+=s[i],s2+=s[i],s3+=s[i],f[s[i]-'A']=true;
            }
        }
        else{
            s1+=s[i],s2+=s[i],s3+=s[i],f[s[i]-'A']=true;
        }
    }
    if(s!=s1){
        bool ret=false;
        if(!f[0])ret|=solve(s1);
        if(!f[1])ret|=solve(s2);
        if(!f[2])ret|=solve(s3);
        return ret;
    }
    return false;
}

void run(){
    string s;
    cin>>s;
    Yes(solve(s));
}

```