C++|BitMask
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: O(n*10)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        int n = s.size();\n\n        unordered_map<long long,long long>mp;\n\n        mp[0] = -1;\n        long long hash = 0;\n        long long res = 1;\n        for(int i = 0; i<n; i++){\n            hash = hash^(1<<(s[i]-\'0\'));\n            for(int j = 0; j<=9; j++){\n                if(mp.find(hash^(1<<j))!=mp.end())\n                    res = max(res, i-mp[hash^(1<<j)]);\n            }\n            if(mp.find(hash)==mp.end()){\n                \n                mp[hash] = i;\n            }\n            else res = max(res, i-mp[hash]);\n            \n        }\n\n        return res;\n    }\n};\n```
['C++']