题意
A被称为是B的子串的要求是:A只能由B从头和尾删除字符得到。
比如:b="abc",那么"a","b","c","ab","bc","abc"都是B的子串,而"ac"不是。
给定一个字符串S,问怎么排列S可以使得S的子串中回文子串数量最多。多解输入任意一个。
思路
想到好像相同的排在一起最优,于是尝试就AC了。
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
typedef long long LL;
int n;
string a;
int main()
{
cin >> n >> a;
sort(a.begin(), a.end());
cout << a << endl;
return 0;
}
/*
5
oolol
*/