#include <iostream>
#include <string>
using namespace std;

bool dfs(string S) {
	if (S == "ABC") return true;

	for (int i = 0; i < 3; i++) {
		string T = ""; bool OK = false;
		for (int j = 0; j < (int)S.size(); j++) {
			if ((j + 2 < (int)S.size()) && S.substr(j, 3) == "ABC") {
				T += ('A' + i); j += 2;
			}
			else {
				T += S[j]; if (S[j] == ('A' + i)) OK = true;
			}
		}
		if (OK == true) continue;
		if (S.size() == T.size()) break;
		bool ret = dfs(T);
		if (ret == true) return true;
	}
	return false;
}

string S;

int main() {
	cin >> S;
	bool ans = dfs(S);
	if (ans == true) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}
