[C++] O(11n) bitmask
[a, b] is an awesome substring if at most one letter appears odd number of times in [a, b].\n\nlet dp[i] = parity of each letter in [0, i] by setting j-th bit t
[a, b] is an awesome substring if at most one letter appears odd number of times in [a, b].\n\nlet dp[i] = parity of each letter in [0, i] by setting j-th bit to 1 if \'j\' appears odd number of times in [0, i], otherwise 0.\n\ns[a, b] is an awesome substring if dp[a] ^ dp[b] == 0 or (1 << k) for some k\n\n```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        int n = s.size();\n        vector<int> dp(1 << 10, -1);\n        int x = 0;\n        for(int i = 0; i < n; ++i) {\n            x ^= 1 << (s[i] - \'0\');\n            dp[x] = i;\n        }\n        int ans = 1;\n        x = 0;\n        for(int i = 0; i < n; ++i) {\n            ans = max(ans, dp[x] - i + 1);\n            for(int j = 0; j < 10; ++j) {\n                ans = max(ans, dp[x ^ (1 << j)] - i + 1);\n            }\n            x ^= 1 << (s[i] - \'0\');\n        }\n        return ans;\n    }\n};\n```
[]