str = proc{Array.new(gets.chomp.split("")).sort} a=str[] b=str[] puts a==b ? "YES" : "NO"