#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	bool ret = (s == "ABC");
	while (!ret) {
		vector<int> v(s.size(), 0);
		for (int i = 2; i < s.size(); i++) {
			if (s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C') {
				v[i - 2] = v[i - 1] = v[i] = 1;
			}
		}
		vector<int> ok(3, 1);
		for (int i = 0; i < s.size(); i++) ok[s[i] - 65] &= v[i];
		if (ok[0] + ok[1] + ok[2] != 1) break;
		int z = -1;
		for (int i = 0; i < 3; i++) if (ok[i]) z = i;
		string res;
		for (int j = 0; j < s.size();) {
			if (j <= s.size() - 3 && v[j] == 1) res += (char)(z + 65), j += 3;
			else res += s[j], j++;
		}
		if (res == "ABC") { ret = true; break; }
		if (res.size() != s.size()) s = res;
		else break;
	}
	cout << (ret ? "Yes" : "No") << endl;
	return 0;
}