#include using namespace std; int main(){ string hackerrank = "hackerrank"; int q; cin >> q; for(int a0 = 0; a0 < q; a0++){ string s; cin >> s; // your code goes here size_t pos = 0; bool works = true; for (int i = 0; i < hackerrank.length(); i++) { char target = hackerrank[i]; size_t found_pos = s.find(target, pos); if (found_pos != string::npos) { pos = found_pos + 1; // avoid dupes } else { works = false; break; } } if (works) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }