string = readlines string.each_with_index do |line, index| if index + 1 == string.length print "NO" return end length = line.length length.times do |i| index = i current_char = line[index] if current_char == "L" index = index + 1 next_char = line[index] if next_char == "O" index = index + 1 next_char = line[index] if next_char == "V" index = index + 1 next_char = line[index] if next_char == "E" print "YES" return end end end end end end