COCI 2007/2008, Contest #4
Your program will be given an integer X. Find the smallest number larger than X consisting of the same digits as X.
The first line of input contains the integer X (1 ≤ X ≤ 999 999).
The first digit in X will not be a zero.
Output the result on a single line. If there is no such number, output 0.
Point Value: 5
Time Limit: 1.00s
Memory Limit: 32M
Added: Aug 02, 2013
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Well, I did after a night of sleep and learnt something new again: thanks guys for the ever interesting problems :)!
[I hope I am not annoying you, but seeing that you are doing a good work, yet I presume still a hard one, you surely deserve some praise once in a while, ne?]