<p>You are given a string <code>s</code>. An <strong>awesome</strong> substring is a non-empty substring of <code>s</code> such that we can make any number of swaps in order to make it a palindrome.</p>

<p>Return <em>the length of the maximum length <strong>awesome substring</strong> of</em> <code>s</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;3242415&quot;
<strong>Output:</strong> 5
<strong>Explanation:</strong> &quot;24241&quot; is the longest awesome substring, we can form the palindrome &quot;24142&quot; with some swaps.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;12345678&quot;
<strong>Output:</strong> 1
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;213123&quot;
<strong>Output:</strong> 6
<strong>Explanation:</strong> &quot;213123&quot; is the longest awesome substring, we can form the palindrome &quot;231132&quot; with some swaps.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
	<li><code>s</code> consists only of digits.</li>
</ul>

int mp[1024];
class Solution {
    int increment(vector<int>&vow,char ch){
        vow[ch-48]++;
        int num=0;
        for(int i=0;i<10;i++){
            if(vow[i]%2==1){
                num=num|(1<<i);
            }
        }
        return num;
    }
public:
    int longestAwesome(string s) {
        // unordered_map<int,int>mp;
        // memset(mp,-100,sizeof mp);
        for(int i=0;i<1024;i++){
            mp[i]=-10;
        }
        mp[0]=-1;
        vector<int>vow(10,0);
        int n=s.length(),ans=0;
        for(int i=0;i<n;i++){
            int num=increment(vow,s[i]);//increment the vow and return corresp num
            for(int j=0;j<10;j++){
                int temp=num^(1<<j);
                // cout<<temp<<" "<<mp[temp]<<"--";
                if(mp[temp]>-10){
                    ans=max(ans,i-mp[temp]);
                }
            }
            if(mp[num]>-10){
                // cout<<num<<" "<<mp[num]<<endl;
                ans=max(ans,i-mp[num]);
            }
            else{
                // cout<<num<<" "<<-1<<endl;
                mp[num]=i;
            }
        }
        return ans;
    }
};
10700