#include <iostream>
#include <string>
#include <cstdio>

using namespace std;


int main() {
	string S;
	cin >> S;
	if(S == "ABC") {
		cout << "Yes" << endl;
		return 0;
	}

	char c;
	while(1) {
		int cou = 0;
		string tmp = "";
		int alf[3] = {};
		for(int i = 0; i < S.size(); i++) {
			alf[S[i] - 'A']++;
		}
		
		if(alf[0] <= alf[1] && alf[0] <= alf[2]){ c = 'A';cou++;}
		if(alf[1] <= alf[0] && alf[1] <= alf[2]){ c = 'B';cou++;}
		if(alf[2] <= alf[0] && alf[2] <= alf[1]){ c = 'C';cou++;}
		if(cou > 1){
			cout << "No" << endl;
			return 0;
		}

		for(int i = 0; i < S.size(); i++) {
			if(i < S.size() - 2 && S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') {
				tmp += c;
				i += 2;
				cou++;
			} else {
				tmp += S[i];
			}
		}

		if(tmp == "ABC") {
			cout << "Yes" << endl;
			return 0;
		}
		if(S == tmp) {
			cout << "No" << endl;
			return 0;
		}

		S = tmp;
	}

	return 0;
}
