fun readStr () = valOf (TextIO.inputLine TextIO.stdIn) fun insertionSort l = let fun insert x [] = [x] | insert x (y::ys) = if x <= y then x::y::ys else y::(insert x ys) in foldl (fn (x, acc) => insert x acc) [] l end val () = let val a = readStr () val b = readStr () val sortedA = (insertionSort o explode) a val sortedB = (insertionSort o explode) b val ans = if sortedA = sortedB then "YES\n" else "NO\n" in print ans end