Python3 | Prefix xor | O(n) Solution
Time Complexity: O(n) ->  O(512n) in worst case?\n\n\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        # li = [1, 2, 4, 8, 16, 32, 64, 128
Time Complexity: O(n) ->  O(512n) in worst case?\n\n```\nclass Solution:\n    def longestAwesome(self, s: str) -> int:\n        # li = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]\n        li = [2**i for i in range(10)]\n        # checker = {0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512}\n        checker = set(li)\n        checker.add(0)\n        # di: k = prefix xor, v = the first idx I got a new prefix_xor_value.\n        di = collections.OrderedDict({0: -1})\n        maxLength = prefix_xor = 0\n        \n        for i in range(len(s)):\n            prefix_xor ^= li[int(s[i])]\n            # Found a new prefix_xor_value\n            if prefix_xor not in di:\n                di[prefix_xor] = i\n            \n            # XOR operation with previous prefix_xor_value\n            for key in di.keys():\n                if i - di[key] <= maxLength:\n                    break\n\t\t\t\t# s[di[key] : i] is Awesome Substring\n                if key ^ prefix_xor in checker:\n                    maxLength = i - di[key]\n        return maxLength\n            \n```
['Python3']