Source codeAs follows:
# Include <stdio. h>
# Include <stdlib. h>
# Include <string. h>
Char * maxsubstr (char character string [], char longstring [])
{
Int I;
Int J;
Char x substr = malloc (256 );
Longstring [strlen (longstring)-1] = 'M ';
If (strstr (longstring, substring string )! = NULL)
Return response string;
For (I = strlen (random string)-1; I> 0; I --)
For (j = 0; j <strlen (random string)-I; j ++)
{
Memcpy (substr, & prop string [J], I );
Substr [I] = '/0 ';
If (strstr (longstring, substr )! = NULL)
Return substr;
}
Return NULL;
}
int main (INT argc, char ** argv)
{< br> char * str1 = malloc (256 );
char * str2 = malloc (256);
char * Common = NULL;
puts ("Please input two strings :");
scanf ("% S % s", str1, str2);
If (strlen (str1) common = maxsubstr (str1, str2);
else
common = maxsubstr (str2, str1);
printf ("the max common string is: % s/n ", common);
printf ("/n % s ", str2);
return 0;
}