C++
(```)  class Solution {\npublic:\n    int longestAwesome(string s)\n    {\n        unordered_map map;\n        \n        int mask = 0, maxL = 0;\n        \n    
(```)  class Solution {\npublic:\n    int longestAwesome(string s)\n    {\n        unordered_map<int,int> map;\n        \n        int mask = 0, maxL = 0;\n        \n        map[mask] = -1;\n        \n        for(int i=0; i<s.size(); ++i)\n        {\n            int ch = s[i]-\'0\';\n            \n            mask = mask ^ (1<<ch);\n            \n            if(map.find(mask) != map.end())\n            {\n                maxL = max(maxL, i-map[mask]);\n            }\n            \n            for(int x=0; x< 10; ++x)\n            {\n                int newMask = mask^(1<<x);\n                \n                if(map.find(newMask) != map.end())\n                {\n                    maxL = max(maxL, i-map[newMask]);\n                }\n            }\n            \n            if(map.find(mask) == map.end())\n            {\n                map[mask] = i;\n            }\n        }\n        return maxL;\n    }\n};\n
[]