a = gets.chomp.split("").sort! b = gets.chomp.split("").sort! puts (a == b) ? "YES" : "NO"