My issue
ghyg
My code
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
unordered_map<char,int>mp;
for(int i=0;i<n;i++){
// mp[i]=s[i];
mp[s[i]]++;
}
int c2=0,count=0;
for(auto ele:mp){
// if(ele.second%2!=0){
// count++;
// }
if(ele.second%2==0) c2++;
}
if(c2>=1 && s.length()>=2){
cout<<s.length()-2<<endl;
}
else cout<<"-1"<<endl;
}
return 0;
}
Problem Link: QTOO_2523 Problem - CodeChef