#!/bin/ruby hackerrank = "hackerrank".split("") q = gets.strip.to_i for a0 in (0..q-1) s = gets.strip indexes = [] f = s.dup # your code goes here last_index = 0 "hackerrank".split("").each do |letter| slice_index = f[(last_index)..-1].index(letter) if slice_index index = slice_index + last_index indexes << index last_index = index + 1 #because want to start at next index end end if indexes.length == 10 puts 'YES' else puts 'NO' end end