#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

bool check(string s) {
  while(s.size() > 3) {
    char c = 'B';
    if(s.substr(0, 3) == "ABC") c = 'A';
    else if(s.substr(s.size() - 3) == "ABC") c = 'C';
    string nxt;
    for(int i = 0; i < s.size(); i++) {
      if(s.substr(i, 3) == "ABC") nxt += c, i += 2;
      else if(s[i] == c) return false;
      else nxt += s[i];
    }
    if(nxt == s) return false;
    s = nxt;
  }
  return s == "ABC";
}

int main() {
  string S;
  cin >> S;
  puts(check(S) ? "Yes" : "No");
}

