Simple clean BITMASK solution
\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n    unordered_map<int,int>mp;\n    int result=0;\n    for (int i=0;i<10;i++)\n    {\n        mp
```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n    unordered_map<int,int>mp;\n    int result=0;\n    for (int i=0;i<10;i++)\n    {\n        mp[i]=(1<<i);\n    }\n        \n// set bit denotes current element has occured odd number of times\n// when we are at i , we calculate length of longest substring ending at index i which can be made as a palindrome\n        \n    unordered_map<int,int> maskedindex;\n    int mask=0;\n    maskedindex[0]=-1;\n    for (int i=0;i<s.size();i++)\n    {\n        mask=mask^(mp[s[i]-\'0\']);\n        for (int j=0;j<10;j++)\n        {\n            \n            mask=mask^(mp[j]);\n           if (maskedindex.find(mask)!=maskedindex.end())\n           {\n            result=max(result,i-maskedindex[mask]);\n           }\n         mask=mask^(mp[j]);   \n        }\n        \n        if (maskedindex.find(mask)==maskedindex.end())\n            maskedindex[mask]=i;\n        else\n        {\n            result=max(result,i-maskedindex[mask]);\n        }\n  \n        \n    }\n        \n        return result;\n        \n    }\n};\n\n```
[]