#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));
}
