object Main extends App {    
  val s = readLine
  val t = readLine
  var same= {for(i <- 0 to s.length -1) yield (s(i), t(i))}.toSet.toList
  
  def loop(list: List[Any], sList: String): String = list.head match {
    case _ if t == sList => "Yes"
    case (left, right) =>
      val nextList = sList.map(l => l match {
      	case l if l == left => right
        case l if l == right => left
        case _ => l
      })
      loop(list.tail, nextList.mkString)
    case Nil => "No"
  }
  println(loop(same :+ Nil, s))
}