comefrom: <doocs>1180.Count Substrings with Only One Distinct Letter_1.py
code: def countLetters( s: str) -> int:
      n = len(s)
      i = ans = 0
      while i < n:
          j = i
          while j < n and s[j] == s[i]:
              j += 1
          ans += (1 + j - i) * (j - i) // 2
          i = j
      return ans
masked: def sample_funcname ( var_0 : str ) -> int :
      var_1 = len ( var_0 )
      var_3 = var_2 = 0
      while var_3 < var_1 :
          var_4 = var_3
          while var_4 < var_1 and var_0 [ var_4 ] == var_0 [ var_3 ] :
              var_4 += 1
          var_2 += ( 1 + var_4 - var_3 ) * ( var_4 - var_3 ) // 2
          var_3 = var_4
      return var_2
  