#K64772. Smallest Lexicographical String
Smallest Lexicographical String
Smallest Lexicographical String
Given an integer \(N\) denoting the length of a string \(S\), and the string \(S\) itself, you are allowed to perform any number of swap operations. Your task is to rearrange the characters of the string \(S\) to form the lexicographically smallest string possible.
Formally, you need to find the smallest permutation of \(S\) in lexicographical order, which can be represented as:
ans = sorted(S)
Note that for any string \(S\), swapping any two characters an arbitrary number of times allows you to obtain any permutation of \(S\).
inputFormat
The input is given from stdin and consists of two lines:
- The first line contains an integer \(N\) representing the length of the string \(S\).
- The second line contains the string \(S\) consisting of \(N\) characters.
outputFormat
Output the lexicographically smallest string that can be obtained after performing any number of swap operations on \(S\). The answer should be printed to stdout.
## sample5
baced
abcde