n = gets.split("").sort m = gets.split("").sort if (n | m).sort == n && (n | m).sort == m puts "YES" else puts "NO" end