/***************************************************************************** * Section 15 * M/c No : M * Roll No : 18CS100XY * Names : Anirban Ghose, Soumyajit Dey, Aritra Hazra * Problem No : LT1-EVEN-2 * Description : Program to find the given prefix in all substrings of a string ******************************************************************************/ #include #include #include // checks whether string 'str' occurs anytime in string 'textString[0..index]' int isUnique(int index, int l, char *textString, char *str) { int i, j, k, counter = 0, n = index; char *tempStr = (char*)malloc((index+1)*sizeof(char)); for (i=0; i n) { /* prefix string is longer than text string */ printf("++ Number of Prefix Instances Found: 0\n"); } else { printf("++ Prefix Matched Substring Instances:"); /* Generating all substrings */ for (l=1; l<=n; l++) { /* check only those substrings whose length >= length of prefixString */ if ( m <= l ) { for (i=0; i