Update longestCommonSubstring