let to_list str = let rec doit i acc = if i < 0 then acc else doit (i - 1) (String.get str i :: acc) in doit (String.length str - 1) [] let () = let a, b = Scanf.scanf "%s %s " (fun a b -> a, b) in let sort l = List.fast_sort (fun x y -> Char.code x - Char.code y) l in let a = to_list a |> sort in let b = to_list b |> sort in print_endline (if a = b then "YES" else "NO")