本站作为LDUOnlineJudge的测试版本进行演示,官方网站请访问http://icpc.ldu.edu.cn
[Hidden ☆ before use]

1339. B. Sort by Frequency


Description

We all have heard the expression “more is better” so, in this problem, we are going to give higher precedence to the letter occurring the most.


The Problem:
Given a string containing only lowercase letters, you are to sort the letters in the string such that the letter occurring the most appears first, then the letter occurring the second most, etc. If two or more letters occur the same number of times, they should appear in alphabetical order in the output.

Input

The input consists of a single string, appearing on a line by itself, starting in column 1 and not exceeding column 70. The input will contain only lowercase letters (at least one letter).

Output

Print the sorted version of the input string, all on one line with no spaces.

Samples

Input Copy
dcbbdabb
Output
bbbbddac

Source

UCF2019
Problem Information

Time Limit: 1000MS (C/C++,Others×2)
Memory Limit: 128MB (C/C++,Others×2)
Special Judge: No
AC/Submit: 1 / 1
Tags:
Contests involved

1038. UCF 2019
My history solutions

You didn't submit any solution!
Submit your solution

Login Register