#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

string rep1(string& s)
{
	string res;
	REP(i, s.size())
	{
		if (i + 2 < s.size() && s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
		{
			res += 'X';
			i += 2;
		}
		else res += s[i];
	}
	return res;
}

string rep2(string& s, char c)
{
	string res = s;
	for (auto &t : res)
	{
		if (t == 'X') t = c;
	}
	return res;
}

string rep3(string &s, char c)
{
	string res;
	for (auto &t : s)
	{
		if (t == c) res += "ABC";
		else res += t;
	}
	return res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	string s; cin >> s;
	if (s == "ABC")
	{
		cout << "Yes" << endl;
		return 0;
	}
	queue<pair<string, string>> que;
	que.emplace(s, "");
	vs ans;
	while (!que.empty())
	{
		string t = que.front().first;
		string op = que.front().second;
		que.pop();		
		string a = rep1(t);
		if (a.size() == t.size()) continue;
		for (char c = 'A'; c <= 'C'; c++)
		{
			string b = rep2(a, c);
			if (b == "ABC")
			{
				ans.push_back(op + c);
				continue;
			}
			que.emplace(b, op + c);
		}
	}
	for(auto t: ans)
	{
		string tmp = "ABC";
		for (int i = t.size() - 1; i >= 0; i--)
		{
			tmp = rep3(tmp, t[i]);
		}
		if (tmp == s)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}