#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

bool check(string s){
    if (s == "ABC") return 1;
    string s_next;
    VI exist(3);
    REP(i,s.length()){
        if (s.substr(i,3) == "ABC"){
            s_next += 'X';
            i += 2;
        }else{
            s_next += s[i];
            exist[s[i]-'A'] = 1;
        }
    }
    if (s_next.size() == s.size()) return 0;
    bool f = 0;
    REP(k,3){
        if (exist[k] == 1) continue;
        string t = s_next;
        REP(i,t.length()) if (t[i] == 'X') t[i] = 'A' + k;
        f |= check(t);
    }
    return f;
}

int main() {
    string s;
    cin >> s;
    cout << (check(s) ? "Yes" : "No") << endl;
    return 0;
}