#include #include using namespace std; int main() { string hack = "hackerrank"; int q; cin >> q; for (int i = 0; i < q; i++) { string test; cin >> test; int j; size_t found; for (j = 0; j <10 ; j++) { found = test.find(hack[j]); if (found == string::npos) break; test = test.assign(test, found + 1, string::npos); } if (j < 10) { cout << "NO\n"; } else if (j==10) { cout << "YES\n"; } } }