Longest Common Substring modified