fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!

    val n = s.length
    val sArr = IntArray(26){0}
    val tArr = IntArray(26){0}
    repeat(n) {
        sArr[s[it] - 'a']++
        tArr[t[it] - 'a']++
    }

    sArr.sort()
    tArr.sort()

    var ans = true

    repeat(26) {
        if (sArr[it] != tArr[it]) ans = false
    }
    if (ans) println("Yes")
    else println("No")
}
