Back
Close

Next growing number

Statement

 Goal

A growing number is a number where each digit, from left to right, is greater than or equal to the previous one.

Given a growing number n, you have to find the first growing number > n.

Example :
With n = 19, the first growing number greater than n is 22, because both 20 and 21 have a second digit that is smaller than the first one.
Input
A growing number n
Output
The next growing number
Constraints
0≤n≤10^50
Example
Input
35
Output
36

Game modes
Fastest, Shortest

Test cases
Just n+1 Test
Input
35
Output
36

Validator 1 Validator
Input
123
Output
124

Example Test
Input
19
Output
22

Validator 2 Validator
Input
49
Output
55

A bigger one Test
Input
123345999
Output
123346666

Validator 3 Validator
Input
244556999
Output
244557777

Only 9 Test
Input
9999999
Output
11111111

Validator 4 Validator
Input
999999999
Output
1111111111

A big number Test
Input
6999999999999999999999999999999999
Output
7777777777777777777777777777777777

Validator 5 Validator
Input
55699999999999999999999999999999999999999999999
Output
55777777777777777777777777777777777777777777777

Solution language

Solution

Stub generator input