gene = STDIN.gets.chomp

while true 
  if gene == 'ABC' then 
    puts 'Yes'
    break
  end

  if gene.size <= 4 then
    puts 'No'
    break
  end

  gene.gsub!(/ABC/, 'X')

  if !gene.include?('A') and gene.include?('B') and gene.include?('C') then
    gene.gsub!(/X/, 'A')
  elsif gene.include?('A') and !gene.include?('B') and gene.include?('C')  then
    gene.gsub!(/X/, 'B')
  elsif gene.include?('A') and gene.include?('B') and !gene.include?('C') then
    gene.gsub!(/X/, 'C')
  end
end