12314 - Quiz5 (Frequency Sort)
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description

Encode a word based on the character distribution in a text.
Input
- The first line of input contains a single positive integer n (number of lines of the text) and a word, separated by a comma, followed by newline.
- The next n lines contains zero or more characters(with whitespace), they all end in newlines. This will be the text.


Output
The word reordered using the character distribution order, followed by a new line.


Tags