#C2852. Smallest Permutation

    ID: 46214 Type: Default 1000ms 256MiB

Smallest Permutation

Smallest Permutation

Given a non-negative integer n, rearrange its digits to form the smallest possible integer. Note that the resulting number must not have any leading zero (except in the case where the number is 0).

Example:

  • If n = 34021, then the smallest permutation is 10234.
  • If n = 111332, then the smallest permutation is 111233.

Your task is to implement a program to compute this smallest permutation.

inputFormat

The input consists of a single non-negative integer n (0 ≤ n ≤ 109) read from stdin.

outputFormat

Output the smallest possible integer that can be formed by rearranging the digits of n to stdout. The output should not contain any leading zeros (except when the number is 0).

## sample
34021
10234