class SortFreely attr_reader :a, :b def initialize(a: "", b: "") @a, @b = a, b end def cause begin @a = gets.chomp @b = gets.chomp rescue end end def judgment(str1, str2) (str1.split("").sort == str2.split("").sort)? "YES" : "NO" end def result puts judgment(@a, @b) end def run cause result end end if $0 == __FILE__ SortFreely.new.run end