import scala.io.StdIn._
object Main{
  def main(args: Array[String]): Unit = {
    val s1 = readLine
    val s2 = readLine
    if(s1.length!=s2.length) return
    for(i <- 0 to s1.length){
      val sa = s1.substring(i)
      val sb = s1.replaceFirst(sa,"")
      if(sa+sb == s2){
        println("Yes")
        return
      }
    }
    println("No")
  }
}
