import java.util.Scanner

import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def conv(s: String): Seq[Int] = {
    val m = new mutable.HashMap[Char, Int]()
    var n = 0
    s.map { c =>
      if (!m.contains(c)) {
        m(c) = n
        n += 1
      }
      m(c)
    }
  }

  def solve(sc: Scanner): String = {
    val S = sc.next
    val T = sc.next

    if (conv(S) == conv(T)) "Yes" else "No"
  }
}
