object Main extends App {	
  val s = readLine.split("").toList.tail
  val t = readLine.split("").toList.tail
  
  def reverse(list: List[String]): String = list match {
  	case _ if list == t => "Yes"
    case l if list != s => reverse(l.last :: l.init)
    case _  => "No"
  }
  println(if(s == t) "Yes" else reverse(s.last :: s.init))
}