#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
string a;
bool dfs(string s){
  if(s.size()<=3)return s=="ABC";
  string s1,s2,s3;
  int v[3]={};
  r(i,s.size())

    if(i+2<s.size())

      if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
        s1+="A",s2+="B",s3+="C",i+=2;

      else s1+=s[i],s2+=s[i],s3+=s[i],v[s[i]-'A']++;

    else s1+=s[i],s2+=s[i],s3+=s[i],v[s[i]-'A']++;

  if(s!=s1){
    if(!v[0])if(dfs(s1))return 1;
    if(!v[1])if(dfs(s2))return 1;
    if(!v[2])if(dfs(s3))return 1;
  }
  return 0;
}
int main(){
  cin>>a;
  cout<<(dfs(a)?"Yes":"No")<<endl;
 }