import scala.io.{StdIn => in}

object Main extends App {
  val s = in.readLine
  val t = in.readLine

  def rec(cnt:Int, s1:String, s2:String):Boolean = {
    if(cnt == s1.size) s1 == s2
    else if(s1 == s2) true
    else rec(cnt+1, s1.last+s1.init,s2)
  }

  val ans = if(rec(0,s,t)) "Yes" else "No"
  println(ans)
}