Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n;
- string s;
- cin>>n>>s;
- vector<int> cnt(26);
- for(auto e: s)
- cnt[e-'a']++;
- int mmax = *max_element(cnt.begin(), cnt.end());
- cout<<max(n%2, max(0, 2*mmax-n))<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment