C++ Solution  | Explained why need for Bitmanipulation or Hashmap| Easy peasy:)
Intuition\nis we have observed a state of mask before it has occured now,then an even length palindrome has occured since all the characters which occured have 
# Intuition\nis we have observed a state of mask before it has occured now,then an even length palindrome has occured since all the characters which occured have count as even, or if some other mask has occured before which has 1 bit different than the current mask,this means a odd length palindrome has occured,as they have only one character having odd count and all others even count.Also if the mask has become zero or only one bit is sent in the mask means that from the indx=0 to the current index either even length or odd length palindrome has occured respectively.\n\nWe need to make a check on the above three conditions also if a mask has not occured yet we will store its value int he hashtable with value as current index.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Code\n```\nclass Solution {\npublic:\n    int longestAwesome(string s) {\n        //using a count of digits occuring is bad in this case ,because it will not tell us that which occuring digits don\'t match.\n        //masking will help us to store a state that has occured previously.\n        //thus using masking we can solve the question easily.\n\n        int mask=0;\n        int ans = 1;\n        unordered_map<int,int> mp;\n        mp[0] = -1;\n        for(int i=0;i<s.size();i++){\n            int digit = s[i]-\'0\';\n            int p = 1<<digit;\n            mask^=p;\n            if(!mp.count(mask)){\n                mp[mask] = i;\n            }else{\n                ans = max(ans,i-mp[mask]);\n            }\n\n            if(mask&(mask-1)==0){\n                ans = max(ans,i+1);\n            }\n\n            for(int j=0;j<10;j++){\n                int nmask = mask^(1<<j);\n                if(mp.count(nmask)){\n                    ans = max(ans,i-mp[nmask]);\n                }\n            }\n        }\n\n        return ans;\n    }\n};\n```
['C++']