A=gets.chomp.split("").sort B=gets.chomp.split("").sort if A==B p "YES" else p "NO" end