longestCommonStringImproved