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_1 : int ) -> int :
      var_2 = var_0 [ : var_1 ].count ( 'W' )
      var_3 = var_2
      var_4 , var_5 = var_1 , len ( var_0 )
      while var_4 < var_5 :
          var_2 += var_0 [ var_4 ] == 'W'
          var_2 -= var_0 [ var_4 - var_1 ] == 'W'
          var_3 = min ( var_3 , var_2 )
          var_4 += 1
      return var_3
  