import java.util.Scanner; public class HackerRankInAString { public static void main(String[] args) { Scanner in = new Scanner(System.in); String alphabetic = "hackerrank"; char[] chars = alphabetic.toCharArray(); int q = in.nextInt(); for(int a0 = 0; a0 < q; a0++){ String s = in.next(); // your code goes here int pos = 0; for(int i = 0; i < s.length(); i++){ if(s.charAt(i) == chars[pos]){ pos++; } if(pos == chars.length){ break; } } if(pos == chars.length){ System.out.println("YES"); }else{ System.out.println("NO"); } } in.close(); } }