<qiyuangong>159_Longest_Substring_with_At_Most_Two_Distinct_Characters_1.py
def lengthOfLongestSubstringTwoDistinct( s):
    i, j, maxLen = 0, -1, 0
    for k in range(1, len(s)):
        if s[k] == s[k - 1]:
            continue
        if j >= 0 and s[j] != s[k]:
            maxLen = max(k - i, maxLen)
            i = j + 1
        j = k - 1
    return max(len(s) - i, maxLen)
def sample_funcname ( var_0 ) :
    var_2 , var_4 , var_5 = 0 , - 1 , 0
    for var_8 in range ( 1 , len ( var_0 ) ) :
        if var_0 [ var_8 ] == var_0 [ var_8 - 1 ] :
            continue
        if var_4 >= 0 and var_0 [ var_4 ] != var_0 [ var_8 ] :
            var_5 = max ( var_8 - var_2 , var_5 )
            var_2 = var_4 + 1
        var_4 = var_8 - 1
    return max ( len ( var_0 ) - var_2 , var_5 )
