using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int q = Convert.ToInt32(Console.ReadLine()); for(int a0 = 0; a0 < q; a0++){ string s = Console.ReadLine(); string temp_string = s; string comp_string = "hackerrank"; string out_string = null; int i = 0; while (i < comp_string.Length) { if (temp_string.Length <= 0){ break; } for (int j = 0; j < temp_string.Length; j++) { if (comp_string[i] == temp_string[j]) { out_string = out_string + temp_string[j]; temp_string = temp_string.Substring(j + 1, temp_string.Length - 1); i++; break; } else { temp_string = temp_string.Substring(j + 1, temp_string.Length - 1); break; } } } if(out_string==comp_string){ Console.WriteLine("YES"); } else{ Console.WriteLine("NO"); } } } }