import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val a = input.nextLine()
      val b = input.nextLine()

      if (a.zip(b).groupBy { case (ac, bc) => bc }.forall { case (c, paris) => paris.forall(_ == paris.head) })
        println("Yes")
      else
        println("No")
    }

  }

}
