Bitmask || CPP || Easy to understand
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:\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        int mask=0;\n        unordered_map<int,int>mp;\n        mp[0]=-1;\n        int ans=0;\n        for(int i=0;i<n;i++)\n        {   \n            mask = mask^(1<<(s[i]-\'0\'));           \n\n            for(int j=0;j<10;j++)\n            {\n                int new_mask = mask^(1<<j);\n\n                if(mp.find(new_mask)!=mp.end())\n                ans=max(ans,i-mp[new_mask]);\n            }\n            if(mp.find(mask)==mp.end())\n            mp[mask] = i;\n            else \n            ans = max(ans,i-mp[mask]);\n\n        }\n        return ans;\n    }\n};\n```
['C++']