data=gets.chomp
target = "ABC"
if data.eql?(target)
  puts "Yes"
  exit
end

tmpA=target
tmpB=target
tmpC=target
while(tmpA.length < data.length)
  tmpA=tmpA.gsub(/(A)/, target)
  tmpB=tmpB.gsub(/(B)/, target)
  tmpC=tmpC.gsub(/(C)/, target)
end

if data.eql?(tmpA) or data.eql?(tmpB) or data.eql?(tmpC)
  puts "Yes"
else
  puts "No"
end