C++ || BitMask || Simple Approach
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 dp[100005];\n    int longestAwesome(string s) {\n        \n        dp[0]=dp[0]+1<<(s[0]-\'0\');\n        \n        for(int i=1;i<s.size();i++)\n        {\n            int temp=(dp[i-1]>>(s[i]-\'0\'))%2;\n            int x=1<<(s[i]-\'0\');\n            if(temp) dp[i]=dp[i-1]-x;\n            else dp[i]=dp[i-1]+x;\n        }\n        int ans=1;\n        map<int,int> m;\n        for(int i=0;i<s.size();i++)\n        {\n            int x=dp[i];\n            int l=dp[i]&(dp[i]-1);\n\n            // Case: 1 if no masked no. is present \n            if(m[dp[i]]==0)m[dp[i]]=i+1;\n            // Case:2 if same masked no. is present in the map\n            else ans=max(ans,i+1-m[dp[i]]+1);\n            // Case:3/4 if the value of mask no. is 0 i.e, all the numbers get balanced or the value is the mask no. just has one setbit i.e, only one no. has odd parity before the current index.\n            if(dp[i]==0||(dp[i]&(dp[i]-1))==0) {ans=i+1;}\n            // Case: 5 if same masked no. is present in the map if we will remove any one setbit from the current mask no. i.e, an odd parity no. is present in between the two ends of the no.\n            for(int pos=0;pos<=10;pos++){\n                int nwmask=dp[i]^(1<<pos);\n                if(m.count(nwmask)){\n                    ans=max(ans,i+1-m[nwmask]);\n                }\n            }\n        }\n            \n        cout<<endl;\n         return ans;\n    }\n};\n\n\n\'\'\'
['C++']