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