#include <bits/stdc++.h>
using namespace std;

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

  string t = regex_replace(s, regex("ABC"), "A");
  if (t.size() != s.size() && regex_replace(t, regex("A"), "ABC") == s) {
    if (dfs(t)) return true;
  }
  t = regex_replace(s, regex("ABC"), "B");
  if (t.size() != s.size() && regex_replace(t, regex("B"), "ABC") == s) {
    if (dfs(t)) return true;
  }
  t = regex_replace(s, regex("ABC"), "C");
  if (t.size() != s.size() && regex_replace(t, regex("C"), "ABC") == s) {
    if (dfs(t)) return true;
  }

  // if (dfs(regex_replace(s, regex("ABC"), "A"))) return true;
  // if (dfs(regex_replace(s, regex("ABC"), "B"))) return true;
  // if (dfs(regex_replace(s, regex("ABC"), "C"))) return true;
  return false;
}

int main() {
  string s;
  cin >> s;

  cout << (dfs(s) ? "Yes" : "No") << endl;
}

