#include using namespace std; bool solve (const string &s) { string test = "hackerrank"; int pos =-1; for (int i=0; i<10; i++) { pos = s.find(test[i], pos+1); //cout << "DEBUG: " << pos << " " << test[i] << endl; if (pos==-1) { return false; } } return true; } int main(){ int q; cin >> q; for(int a0 = 0; a0 < q; a0++){ string s; cin >> s; if (solve(s)) { cout << "YES" << endl; } else { cout << "NO" << endl; } // your code goes here } return 0; }