/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
正整数 X が与えられます。
X を(先頭に 0 を含まない形で)十進表記した際に現れる数字を、先頭に 0 が来ないように 並び替えることで得られる正整数のうち、値が最小のものを求めてください。
制約
- 1\leq X < 10^5
- X は整数
入力
入力は以下の形式で標準入力から与えられる。
X
出力
答えを出力せよ。
入力例 1
903
出力例 1
309
X を十進表記した際に現れる数字を先頭に 0 が来ないように並び替えることで得られる正整数は、903, 930, 309, 390 の 4 通りであり、このうち値が最小のものは 309 です。
入力例 2
432
出力例 2
234
入力例 3
100
出力例 3
100
Score : 200 points
Problem Statement
You are given a positive integer X.
Find the minimum value among all positive integers that can be obtained by rearranging the digits appearing in the decimal representation of X (without leading zeros) such that there is no leading zero.
Constraints
- 1\leq X < 10^5
- X is an integer.
Input
The input is given from Standard Input in the following format:
X
Output
Output the answer.
Sample Input 1
903
Sample Output 1
309
There are four positive integers that can be obtained by rearranging the digits appearing in the decimal representation of X such that there is no leading zero: 903, 930, 309, 390; the minimum value among them is 309.
Sample Input 2
432
Sample Output 2
234
Sample Input 3
100
Sample Output 3
100