Prabal Kumar Pandey
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(10 * n)\n\n- Space complexity:\nO(1024)\n\n# Code\n```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        static const int ALPHABET_SIZE = 10;\n        int result = 0, mask = 0;\n        vector<int> lookup(1 << ALPHABET_SIZE, s.length());\n        lookup[0] = -1;\n        for (int i = 0; i < s.length(); ++i) {\n            mask ^= 1 << (s[i] - \'0\');\n            if (lookup[mask] == s.length()) {\n                lookup[mask] = i;\n            }\n            result = max(result, i - lookup[mask]);  // no middle\n            for (int d = 0; d < ALPHABET_SIZE; ++d) {\n                result = max(result, i - lookup[mask  ^ (1 << d)]); // as middle\n            }\n            lookup[mask] = min(lookup[mask], i);\n        }      \n        return result;\n    }\n};\n```
['String', 'C++']