[Python3] prefix xor
Toggle bit to indicate if a number has appeared even/odd number of times. \n\n\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        ans = pre
Toggle bit to indicate if a number has appeared even/odd number of times. \n\n```\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        ans = prefix = 0\n        seen = {0: -1}\n        for i, c in enumerate(s):\n            prefix ^= 1 << int(c) #toggle bit \n            ans = max(ans, i - seen.get(prefix, inf))\n            for k in range(10): \n                x = prefix ^ (1 << k) #toggle kth bit \n                ans = max(ans, i - seen.get(x, inf))\n            seen.setdefault(prefix, i)\n        return ans \n```
['Python3']