<p>Given a string <code>s</code> which consists of lowercase or uppercase letters, return the length of the <strong>longest <span data-keyword="palindrome-string">palindrome</span></strong>&nbsp;that can be built with those letters.</p>

<p>Letters are <strong>case sensitive</strong>, for example, <code>&quot;Aa&quot;</code> is not considered a palindrome.</p>

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

<pre>
<strong>Input:</strong> s = &quot;abccccdd&quot;
<strong>Output:</strong> 7
<strong>Explanation:</strong> One longest palindrome that can be built is &quot;dccaccd&quot;, whose length is 7.
</pre>

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

<pre>
<strong>Input:</strong> s = &quot;a&quot;
<strong>Output:</strong> 1
<strong>Explanation:</strong> The longest palindrome that can be built is &quot;a&quot;, whose length is 1.
</pre>

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

<ul>
	<li><code>1 &lt;= s.length &lt;= 2000</code></li>
	<li><code>s</code> consists of lowercase <strong>and/or</strong> uppercase English&nbsp;letters only.</li>
</ul>

class Solution {
public:
    int longestPalindrome(string s) {
       map<char,int>mp;
       vector<int>ch;
       int flg=0;
    //    sort(s.begin(),s.end());
       for(int i=0;i<s.length();i++)
       {
        mp[s[i]]++;
       }
       for(auto it:mp)
       {
          if(it.second%2==0)
          {
            ch.push_back(it.second);
          }
          else
          { 
            if(it.second==1 && flg==0)
            {  
               flg=1;
               ch.push_back(1);
            }
            else
            { 
               int x=it.second/2;
               ch.push_back(x*2);
               if(flg==0)
               {
               ch.push_back(1);
               flg=1; 
               }    
            }

          } 
       }
        int l=0;
       for(int i=0;i<ch.size();i++)
       {
         l+=ch[i];
       }

       return l;
    }
};
9600