#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

string s;
set<string> st;

bool f = false;

void calc(string t) {
	//cout << t << endl;
	if(st.count(t)) return;
	st.insert(t);
	if(f) return;
	if(t == "ABC") {
		f = true;
		return;
	}
	for(int i = 0; i +2 < t.size(); i++) {
		if(t[i] == 'A' && t[i+1] == 'B' && t[i+2] == 'C') {
			t = t.substr(0, i) + "X" + t.substr(i + 3);
		}
	}
	bool f2[3] = {};
	for(auto& c : t) f2[c- 'A'] = true;
	for(int i = 0; i < 3; i++) {
		if(f2[i] == false) {
			string u = t;
			for(int j = 0; j < u.size(); j++) if(u[j] == 'X') u[j] = ('A' + i);
			calc(u);
		}
	}
}

int main(){
	cin >> s;
	calc(s);
	cout << (f?"Yes":"No") << endl;
}