fun c110(args: Array<String>) {
    var mapA = mutableMapOf<Char, Int>()
    args[0].forEach {
        if (!mapA.containsKey(it)) {
            mapA.put(it, 0)
        }
        mapA.put(it, mapA.get(it)!! + 1)
    }

    var mapB = mutableMapOf<Char, Int>()
    args[1].forEach {
        if (!mapB.containsKey(it)) {
            mapB.put(it, 0)
        }
        mapB.put(it, mapB.get(it)!! + 1)
    }

    println(if (mapA.values.sorted() == mapB.values.sorted()) "Yes" else "No")
}

fun main(args: Array<String>) {
    c110(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}