So you can reuse LCS (as indicated above) to find all the regular lines and remove them from both lines, replacing them with another line - let it just say "*". Then you iterate over both lines at the same time, and then combine the common and distinct images again.
Example
A) Hello there! B) Helay scere? LCS detection gives us ["Hel"," ","ere"], and after replacement we have A) *lo*th*! B) *ay*sc*? Now you split on the delimiter ("*") giving you A) ["lo","th","!"] B) ["ay","sc","?"]
And from here you just go to make a simple grid. Something key to note that there may be empty entries, for example, if you do this method on “Hell” and “Hel”, you will end up with
Common LCS) ["Hel"] A) ["l"] B) [""] meaning your result will be Hel[l]()
Hope this is acceptable.
Noxville
source share