Permute to Minimize

AtCoder
IDabc432_b
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
Input #1
903
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$.
Input #2
432
Output #2
234
Input #3
100
Output #3
100
API Response (JSON)
{
  "problem": {
    "name": "Permute to Minimize",
    "description": {
      "content": "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 ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc432_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a positive integer $X$.\nFind the minimum value among all positive integers that can be obtained by rearranging the digits appearing in the decimal representation of $X$ (without leading ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments