Given a string S, find the length of the longest substring T that contains at most two distinct characters.For example,Given S = “eceba”,T is “ece” which its length is 3. 这道题给我们一个字符串,让我们求最多有两个不同字符的最长子串.那么我们首先想到的是用哈希表来做,哈希表记录每个字符的出现次数,然后如果哈希表中的映射数量超过两…