Question: In standard C, write a program that prompts its user for two strings and prints the longest substring that they have in common. In the
In standard C, write a program that prompts its user for two strings and prints the longest substring that they have in common. In the case of a tie, use the first one found from left to right. If the strings do not share any characters, print "No Common Substring". The task should only be performed once per run. Assume each string is only made of uppercase letters. As with psetb, do not declare any arrays in the program using [ ] notation. Instead, use malloc to allocate memory for the array; in other words any arrays used must exist on the heap, not the stack. Be sure to free any allocated blocks by the end of the program (use valgrind to check). Print the entire string at once, not one character at a time.
Sample Output:
Enter S1: QUIZ
Enter S2: LIZARD
IZ
Enter S1: QUIZ
Enter S2: BUZZARD
U
Enter S1: PYTHON
Enter S2: JAVA
No Common Substring
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
