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_1 = len ( var_0 )
      var_2 = '01'
      var_3 = 0
      for var_4 , var_5 in enumerate ( var_0 ) :
          var_3 += var_5 != var_2 [ var_4 & 1 ]
      var_6 = min ( var_3 , var_1 - var_3 )
      for var_4 in range ( var_1 ) :
          var_3 -= var_0 [ var_4 ] != var_2 [ var_4 & 1 ]
          var_3 += var_0 [ var_4 ] != var_2 [ ( var_4 + var_1 ) & 1 ]
          var_6 = min ( var_6 , var_3 , var_1 - var_3 )
      return var_6
  