fun main(arr:Array) { print(if((1..2).map { readLine()!!.toCharArray().sorted().joinToString("") }.let { it[0] == it[1] }) "YES" else "NO") }