n = gets.split("").sort m = gets.split("").sort puts "YES" if n == m puts "NO" if n != m