#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; bool iss(string str1, string str2, int m, int n) { int j = 0; // For index of str1 (or subsequence // Traverse str2 and str1, and compare current character // of str2 with first unmatched char of str1, if matched // then move ahead in str1 for (int i=0; i<n&&j<m; i++) if (str1[j] == str2[i]) j++; // If all characters of str1 were found in str2 return (j==m); } int main() { int a,b,c,d; cin>>a; while(a--) { string s="hackerrank",ste; cin>>ste; if(iss(s,ste,10,ste.length())) cout<<"YES\n"; else cout<<"NO\n"; } return 0; }