#include #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int t, i, j; string str; bool flag; const string match = "hackerrank"; cin >> t; while(t--) { cin >> str; flag = false; for(i=0, j = 0; i < str.length() && !flag; i++) { if(str[i] == match[j]) { j++; if(j == match.size()) { flag = true; } } } if(flag) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }