update solution of Longest-Substring-with-At-Most-Two-Distinct-Characters to O(n)