#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int f=0;
  while(1){
    string s2;
    if(s=="ABC"){
      f=1;
      break;
    }
    if(s.size()<=3)break;
    char a;
    int t=0;
    int si=s.size()-1;
    
    if(s[0]=='A'&&s[1]=='B'&&s[2]=='C')a='A';
    else if(s[si-2]=='A'&&s[si-1]=='B'&&s[si]=='C')a='C';
    else a='B';

    for(int i=0;i<s.size();i++){
      if(i+2<s.size()&&s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
	s2+=a;
	i+=2;
	t=1;
      }else{
	if(s[i]==a){
	  t=0;
	  break;
	}
	s2+=s[i];
      }
    }
		
    //	cout<<s2<<endl;
    s=s2;
    if(t)continue;
    break;
  }
  if(f)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

