My question is how to find the longest common substring from two sentences. For example:
sequence 1 = "there were a dozen eggs in the basket"
sentence 2 = "mike ate a dozen eggs for breakfast"
The longest common substring from sentence 1 and sentence 2 would be "e a dozen eggs ", including the spaces.
My general idea is to create a concatenated string from sentence 1 and sentence 2, separating each sentence with a unique character such as "$" or "#", and then create a suffix tree from these sentences; however, I am not sure how to approach from here.
The longest common substring from two sentences
Using two loops and list comprehension.
Output: