import java.util.*; public class FindSequence { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = Integer.parseInt(scan.nextLine().trim()); FindSequence fs = new FindSequence(); for(int i = 0; i < q; i++) { String s = scan.nextLine().trim(); boolean res = fs.compute(s.toCharArray()); if (res) System.out.println("YES"); else System.out.println("NO"); } } public boolean compute(char[] seq) { char[] map = "hackerrank".toCharArray(); int j = 0; for (int i = 0; i < seq.length && j < map.length; i++) { if (seq[i] == map[j]) j++; } if (j == map.length) return true; return false; } }