#!/bin/ruby q = gets.strip.to_i for a0 in (0..q-1) s = gets.strip reg = 'hackerrank'.chars*'.*' puts s=~/#{reg}/ ? 'YES':'NO' end