Write a function to compute the length of the longest substring of a given string that contains at most two distinct characters?
Login to Submit
The longest continuous part of a string that contains no more than 2 different letters. Example: For "ccaabbb", the longest part with ≤ 2 distinct letters is "aabbb" (length 5). Input:"eceba" Output: 3 Input: "ccaabbb" Output: 5 Input: "a" Output: 1