Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/while/largest-number-from-the-digits

Largest number from the digits

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Medium 1000 ms 64 MB 47%
Share

A positive integer is given. Find the largest number that can be obtained by rearranging its digits (each digit is used as many times as it occurs; for example, ).

Building the largest number by sorting the digits in decreasing order

Input

One positive integer .

Output

One integer — the largest number obtained.

Note

Examples

Input #1
30521
Output #1
53210
Input #2
1000
Output #2
1000

Sign in to submit a solution

Signing up is free and takes a minute.