Update LongestSubstring.