Fixed the longestcommonsubstring algorithm