Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-raqamlaridan-eng-katta-son

Largest number from the digits

Medium 1000 ms 64 MB 47%
Share

A positive integer $n$ 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, $30521 \to 53210$).

Building the largest number by sorting the digits in decreasing order

Input

One positive integer $n$.

Output

One integer — the largest number obtained.

Note

$1 \le n \le 10^{18}$

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.