[Pyhton] Count 01 for odd and even indices
Idea\n1. Count the 0s and 1s for even and odd indices respectively\n2. Get the number Operation 2 required to make the string alternating: \n either all 1s for 
**Idea**\n1. Count the 0s and 1s for even and odd indices respectively\n2. Get the number Operation 2 required to make the string alternating: \n* either all 1s for even, all 0s for odd; \n* or all 0s for even, all 1s for odd\n3. Get the times required for the original string\n4. If the total length of the string is even. It is easy. No matter how many time Operation 1 happens, the counts of even and odds are reversed, while required Operation 2 times remains the same.\n5. \tif the length is odd, each time we move the first digit to the tail, say a \'1\', we have:\n* evens[\'1\'] minus 1 \n* evens and odds are reversed\n* new evens[\'1\'] plus 1\nHence we iterate all digits to move it to the tail and keep track of the min Operation 2 required.\n\n**Python**\n```\n    def minFlips(self, s: str) -> int:\n        \n        evens, odds = Counter(s[0::2]), Counter(s[1::2])\n\t\t# get the min time of operation 2 required: \n\t\t# either all 1s for even, all 0s for odd; \n\t\t# or all 0s for even, all 1s for odd\n        get_min_ops = lambda evens, odds: min(evens[\'0\'] + odds[\'1\'], evens[\'1\'] + odds[\'0\'])\n        res = get_min_ops(evens, odds)\n\t\t\n\t\t# if the length is even, \n\t\t# no matter how many time operation 1 happens, the counts remains the same, so res remains \n        if len(s) % 2 == 0:\n            return res\n\t\t\t\n\t\t# if the length is odd, each time you move the first digit to the tail, say a \'1\'\n\t\t# evens[\'1\'] minus 1 \n\t\t# evens and odds are reversed\n\t\t# new evens[\'1\'] plus 1\n\t\t# iterate all digits and keep track of the min operation 2 required\n        else:\n            for char in s:\n                evens[char] -= 1\n                odds, evens = evens, odds\n                evens[char] += 1\n\n                curr_res = get_min_ops(evens, odds)\n                res = min(res, curr_res)\n            return res\n```
[]