arr = [] arr.push gets.chomp arr.push gets.chomp x = arr[0].split('.') y = arr[1].split('.') if x[0] == y[0] puts arr.sort.reverse == arr ? 'YES' : 'NO' else flag = false x.each_with_index do |e, k| if e < y[k] flag = true elsif e == y[k] else break; end end puts flag ? 'YES' : 'NO' end