I could do longest common substring using two strings each time. But consider 3 strings below:
- ABZDCC
- ABZDEC
- EFGHIC
Here we see that the lcs of the first two strings is ABZD. But when this will be compared to the third string, the length of lcs will be zero. But it is clear that the lcs is "C". How can I find the longest common substring of n strings using suffix array?
When working with more than two strings, find all common substrings between the two shortest input strings and then start eliminating common substrings that aren't included in the other input strings. When done, return the longest common remaining substring.