#include #include #include #include #include #include #include int main(){ int q; int a0; scanf("%d",&q); for(a0 = 0; a0 < q; a0++){ char* s = (char *)malloc(512000 * sizeof(char)); scanf("%s",s); bool isSubSequence(char str1[], char str2[], int m, int n) { // Base Cases if (m == 0) return true; if (n == 0) return false; // If last characters of two strings are matching if (str1[m-1] == str2[n-1]) return isSubSequence(str1, str2, m-1, n-1); // If last characters are not matching return isSubSequence(str1, str2, m, n-1); } // Driver program to test methods of graph class char str1[] = "hackerrank"; char* str2 = s; int m = strlen(str1); int n = strlen(str2); isSubSequence(str1, str2, m, n)? printf("YES"):printf("NO"); printf("\n"); } return 0; }