You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Group same characters together. This will result in maximum substrings being palindrome (all adjacent combination among each group will be a palindrome)
*/
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
string s;
cin>>s;
unordered_map<char,int> cnt;
for(auto c: s) cnt[c]++;
//Group same characters together. This will result in maximum substrings being palindrome