
object Main extends App {
  import scala.io.StdIn._
  val a = readLine.trim.toList
  val b = readLine.trim.toList
  println(
    if (canMakeUseAFirst(a, a, b) || canMakeUseBFirst(a, a, b)) "Yes" else "No"
  )

  def canMakeUseAFirst(target: List[Char], a: List[Char], b: List[Char]): Boolean = {
    target match{
      case Nil ⇒ true
      case h::t ⇒ a.dropWhile(_ != h) match{
        case Nil ⇒ false
        case _::at ⇒ canMakeUseBFirst(t, at, b)
      }
    }
  }
  def canMakeUseBFirst(target: List[Char], a: List[Char], b: List[Char]): Boolean = {
    target match{
      case Nil ⇒ true
      case h::t ⇒ b.dropWhile(_ != h) match{
        case Nil ⇒ false
        case _::bt ⇒ canMakeUseAFirst(t, a, bt)
      }
    }
  }
  implicit class ScopeFunc[T](private val value: T) {
    def let[A](func:T ⇒ A): A = func(value)
    def also(func:T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}

//2,3,5,7,11,13,17,19,23,29,31
