ary1 = gets.chomp!.split('').sort! ary2 = gets.chomp!.split('').sort! if ary1 == ary2 then puts "YES" else puts "NO" end