Codeforces Round 516 (Div. 2, by Moscow Team Olympiad)
C
Oh Those Palindromes
Codeforces
未评级
原题
← BD →
翻译中…

A non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, "abcba", "a", and "abba" are palindromes, while "abab" and "xy" are not.

翻译中…

A string is called a substring of another string, if it can be obtained from that string by dropping some (possibly zero) number of characters from the beginning and from the end of it. For example, "abc", "ab", and "c" are substrings of the string "abc", while "ac" and "d" are not.

翻译中…

Let's define a palindromic count of the string as the number of its substrings that are palindromes. For example, the palindromic count of the string "aaa" is $6$ because all its substrings are palindromes, and the palindromic count of the string "abc" is $3$ because only its substrings of length $1$ are palindromes.

翻译中…

You are given a string $s$. You can arbitrarily rearrange its characters. You goal is to obtain a string with the maximum possible value of palindromic count.

翻译中…

Input

翻译中…

The first line contains an integer $n$ ($1 \le n \le 100\,000$) — the length of string $s$.

翻译中…

The second line contains string $s$ that consists of exactly $n$ lowercase characters of Latin alphabet.

翻译中…

Output

翻译中…

Print string $t$, which consists of the same set of characters (and each characters appears exactly the same number of times) as string $s$. Moreover, $t$ should have the maximum possible value of palindromic count among all such strings strings.

翻译中…

If there are multiple such strings, print any of them.

翻译中…

Note

翻译中…

In the first example, string "ololo" has $9$ palindromic substrings: "o", "l", "o", "l", "o", "olo", "lol", "olo", "ololo". Note, that even though some substrings coincide, they are counted as many times as they appear in the resulting string.

翻译中…

In the second example, the palindromic count of string "abccbaghghghgdfd" is $29$.

翻译中…

样例

Input #1
5
oolol
Output #1
ololo
InputCopy OutputCopy
Input #2
16
gagadbcgghhchbdf
Output #2
abccbaghghghgdfd
InputCopy OutputCopy
题目信息
题号
1064C
时间限制
2 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。