Veci
Your program will be given an integer X. Find the smallest number larger than X consisting of the same digits as X.
InputThe first line of input contains the integer X (1 ≤ X ≤ 999 999). The first digit in X will not be a zero.
OutputOutput the result on a single line. If there is no such number, output 0.
Input
Output
156 Output
165Input
Output
330 Output
0Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.