#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
bool saiki(string s) {
	bool ret = false;
	if (s == "ABC") {
		return true;
	}
	string c[] = { "A","B","C" };
	REP(i, 3) {
		bool check = true;
		string s2=s;
		size_t idx = 0;
		size_t fi = s2.find("ABC", idx);
		while (fi!=string::npos) {
			if (s2.substr(idx, (size_t)(fi - idx)).find(c[i].c_str()) != string::npos) {
				check = false;
				break;
			}
			s2.replace(fi, 3, c[i]);
			idx=fi+1;
			fi = s2.find("ABC", idx);
		}
		if (s2.substr(idx, (size_t)(s2.length() - idx)).find(c[i].c_str()) != string::npos) {
			check = false;
		}
		if (check&&s2.length() < s.length()) {
			//cout << s2 << endl;
			ret |= saiki(s2);
		}
		
	}
	return ret;
}

int main() {
	string s;
	cin >> s;
	cout<<((saiki(s))?"Yes":"No")<<endl;
}
### Prompt

Create a solution in cpp for the following problem:

ABC Gene

There is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by performing the following operations several times.

* Choose one of the letters `A`,` B`, `C`. Let this be x. Replace all x in the gene sequence with `ABC` at the same time.



Given a string S consisting only of `A`,` B`, and `C`. Determine if the gene sequence can be matched to S.

Constraints

* 1 ≤ | S | ≤ 5,000
* S consists only of `A`,` B`, and `C`.



Input Format

Input is given from standard input in the following format.


S


Output Format

Output `Yes` if the gene sequence can be matched to S, and` No` if it cannot be matched.

Sample Input 1


ABC


Sample Output 1


Yes


The gene sequence is `ABC` from the beginning.

Sample Input 2


AABCC


Sample Output 2


Yes


If you select `B` and perform the operation, it becomes` ABC` → `AABCC`.

Sample Input 3


AABCABC


Sample Output 3


No


For example, even if you select `C` and perform an operation, it does not change from` AABCC` to `AABCABC`. Since all `C`s are replaced with` ABC` at the same time, the actual result is `AABCC` →` AABABCABC`.





Example

Input

ABC


Output

Yes

### Response

```cpp
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
bool saiki(string s) {
	bool ret = false;
	if (s == "ABC") {
		return true;
	}
	string c[] = { "A","B","C" };
	REP(i, 3) {
		bool check = true;
		string s2=s;
		size_t idx = 0;
		size_t fi = s2.find("ABC", idx);
		while (fi!=string::npos) {
			if (s2.substr(idx, (size_t)(fi - idx)).find(c[i].c_str()) != string::npos) {
				check = false;
				break;
			}
			s2.replace(fi, 3, c[i]);
			idx=fi+1;
			fi = s2.find("ABC", idx);
		}
		if (s2.substr(idx, (size_t)(s2.length() - idx)).find(c[i].c_str()) != string::npos) {
			check = false;
		}
		if (check&&s2.length() < s.length()) {
			//cout << s2 << endl;
			ret |= saiki(s2);
		}
		
	}
	return ret;
}

int main() {
	string s;
	cin >> s;
	cout<<((saiki(s))?"Yes":"No")<<endl;
}
```