comefrom: <doocs>2379.Minimum Recolors to Get K Consecutive Black Blocks_1.py
code: def minimumRecolors( blocks: str, k: int) -> int:
      cnt = blocks[:k].count('W')
      ans = cnt
      i, n = k, len(blocks)
      while i < n:
          cnt += blocks[i] == 'W'
          cnt -= blocks[i - k] == 'W'
          ans = min(ans, cnt)
          i += 1
      return ans
masked: def sample_funcname ( var_0 : str , var_2 : int ) -> int :
      var_6 = var_0 [ : var_2 ].count ( 'W' )
      var_7 = var_6
      var_8 , var_10 = var_2 , len ( var_0 )
      while var_8 < var_10 :
          var_6 += var_0 [ var_8 ] == 'W'
          var_6 -= var_0 [ var_8 - var_2 ] == 'W'
          var_7 = min ( var_7 , var_6 )
          var_8 += 1
      return var_7
  