Easiest C++ solution
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        int mask =0;\n\n\n        map<int,int> mp;\n        mp[0]=-1;\n\n    
\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        int mask =0;\n\n\n        map<int,int> mp;\n        mp[0]=-1;\n\n        int maxi =1;\n\n        int n =s.size();\n\n        for(int i=0;i<n;i++){\n            mask^=(1<<(s[i]-\'0\'));\n\n            for(int j=0;j<=9;j++){\n                if(mp.find(mask)!=mp.end()){\n                    maxi=max(i-mp[mask],maxi);\n                }\n\n                int odd =mask^(1<<j);\n\n                 if(mp.find(odd)!=mp.end()){\n                    maxi=max(i-mp[odd],maxi);\n                }\n\n            }\n\n            if(mp.find(mask)==mp.end()){\n                mp[mask]=i;\n            }\n\n\n        }\n\n        return maxi;\n    }\n};\n```
['C++']