#include #include #include #include #include #include #include int main(){ int q; char *ref = "hackerrank"; char *my_str; char *my_ref; int count = 0; bool is_present = false; int ref_size = strlen(ref); scanf("%d",&q); for(int a0 = 0; a0 < q; a0++){ char* s = (char *)malloc(512000 * sizeof(char)); scanf("%s",s); // your code goes here int len = strlen(s); my_str = s; my_ref = ref; count = 0; is_present = false; //printf("char : %c ref: %c\n", my_str, my_ref); while (*my_str != '\0' && *my_ref != '\0') { //printf("char : %c ref: %c\n", my_str, my_ref); if (*my_str == *my_ref){ count++; my_str++; my_ref++; if (count == ref_size) { is_present = true; break; } } else { my_str++; } } if (is_present) printf("YES\n"); else printf("NO\n"); } return 0; }