//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL << 30)
#define LLINF (1LL << 60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void) {
	string s;
	cin >> s;
	while (true) {
		if(s.size() <= 3) break;
		//cout << s << endl;
		int f = 1;
		if(s.substr(0, 3) == "ABC") f = 0;
		else if(s.substr(s.size()-3, 3) == "ABC") f = 2;
		int sz = s.size();
		bool up = false;
		REP(i, sz-2) {
			//cout << i << " " << s << " " << s.substr(i, 3) << endl;
			if(i >= s.size()) break;
			if(f == 0 && s[i] == 'A' && s.substr(i, 3) != "ABC") {cout << "No" << endl; return 0;} 
			if(f == 1 && s[i] == 'B' && i > 0 && s.substr(i-1, 3) != "ABC") {cout << "No" << endl; return 0;} 
			if(f == 2 && s[i] == 'C' && i > 1 && s.substr(i-2, 3) != "ABC") {cout << "No" << endl; return 0;} 
			if(s.substr(i, 3) == "ABC") {
				if(f == 0) s = s.substr(0, i) + "A" + s.substr(i+3);
				else if(f == 1) s = s.substr(0, i) + "B" + s.substr(i+3);
				else if(f == 2) s = s.substr(0, i) + "C" + s.substr(i+3);
				up = true;
			}
		}
		if(!up) break;
	}
	//cout << s << endl;
	if(s == "ABC") cout << "Yes" << endl;
	else cout << "No" << endl;

  return 0;
}