comefrom: <doocs>1888.Minimum Number of Flips to Make the Binary String Alternating_1.py
code: def minFlips( s: str) -> int:
      n = len(s)
      target = '01'
      cnt = 0
      for i, c in enumerate(s):
          cnt += c != target[i & 1]
      res = min(cnt, n - cnt)
      for i in range(n):
          cnt -= s[i] != target[i & 1]
          cnt += s[i] != target[(i + n) & 1]
          res = min(res, cnt, n - cnt)
      return res
masked: def sample_funcname ( var_0 : str ) -> int :
      var_4 = len ( var_0 )
      var_6 = '01'
      var_8 = 0
      for var_10 , var_11 in enumerate ( var_0 ) :
          var_8 += var_11 != var_6 [ var_10 & 1 ]
      var_14 = min ( var_8 , var_4 - var_8 )
      for var_10 in range ( var_4 ) :
          var_8 -= var_0 [ var_10 ] != var_6 [ var_10 & 1 ]
          var_8 += var_0 [ var_10 ] != var_6 [ ( var_10 + var_4 ) & 1 ]
          var_14 = min ( var_14 , var_8 , var_4 - var_8 )
      return var_14
  