{{{~cpp #include bool checkSlump(char str[], int index, int *end) { if(str[index] == 'D' || str[index] == 'E') { index++; if(str[index] == 'F') { while(str[index] == 'F') index++; if(str[index] == 'G') { *end = index + 1; return true; } else if(checkSlump(str, index, end)) return true; } } return false; } bool checkSlimp(char str[], int index, int *end) { if(str[index] == 'A') { index++; if(str[index] == 'H') { *end = index + 1; return true; } else if(str[index] == 'B') { index++; if(checkSlimp(str, index, end)) { index = *end; if(str[index] == 'C') { *end = index + 1; return true; } } } else if(checkSlump(str, index, end)) { index = *end; if(str[index] == 'C') { *end = index + 1; return true; } } } return false; } bool checkSlurpy(char str[]) { int end, temp; if(checkSlimp(str, 0, &end)) { if(checkSlump(str, end, &temp)) return true; } return false; } void main() { int n; char strs[10][61]; int i; scanf("%d", &n); for(i = 0 ; i < n ; i++) scanf("%s", strs[i]); printf("SLURPYS OUTPUT\n"); for(i = 0 ; i < n ; i++) { if(checkSlurpy(strs[i])) printf("YES\n"); else printf("NO\n"); } printf("END OF OUTPUT\n"); } }}}