C. Oh Those Palindromes

题意

给以一个字符串,让你重排列,使得回文子串的数目最多

分析

对于一个回文串,在其中加入一些字符并不会使回文子串的个数增加,所以对于相同的字符一起输出即可,我是直接排序

代码

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
char a[N];
int main(){
	int n;
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	while(cin>>n){
		cin>>a;
		sort(a,a+n);
		puts(a);
	}
	return 0;
}
posted @ 2018-10-15 18:16  ChunhaoMo  阅读(157)  评论(0编辑  收藏  举报