class A def initialize a = gets.chomp.chars.sort.join b = gets.chomp.chars.sort.join puts (a == b)? 'YES' : 'NO' end end A.new