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(); // your code goes here var valid = true; var find = "hackerrank"; var sc = 0; var locations = new List(); for (int i = 0; i < s.Length; i++) { if (s[i] == find[sc]) { locations.Add(i); ++sc; if (sc >= 9) { break; } } } if (locations.Count < 9) { valid = false; } Console.WriteLine(valid ? "YES" : "NO"); } } }