comefrom: <qiyuangong>340_Longest_Substring_with_At_Most_K_Distinct_Characters_1.py
code: def lengthOfLongestSubstringKDistinct( s, k):
      count = [0] * 256
      i, numDistinct, maxLen = 0, 0, 0
      for j in range(len(s)):
          if count[ord(s[j])] == 0:
              numDistinct += 1
          count[ord(s[j])] += 1
          while numDistinct > k:
              count[ord(s[i])] -= 1
              if count[ord(s[i])] == 0:
                  numDistinct -= 1
              i += 1
          maxLen =  max(j - i + 1, maxLen)
      return maxLen
masked: def sample_funcname ( var_0 , var_1 ) :
      var_4 = [ 0 ] * 256
      var_5 , var_6 , var_7 = 0 , 0 , 0
      for var_10 in range ( len ( var_0 ) ) :
          if var_4 [ ord ( var_0 [ var_10 ] ) ] == 0 :
              var_6 += 1
          var_4 [ ord ( var_0 [ var_10 ] ) ] += 1
          while var_6 > var_1 :
              var_4 [ ord ( var_0 [ var_5 ] ) ] -= 1
              if var_4 [ ord ( var_0 [ var_5 ] ) ] == 0 :
                  var_6 -= 1
              var_5 += 1
          var_7 = max ( var_10 - var_5 + 1 , var_7 )
      return var_7
  