Different digits
InterviewTime limit1sMemory limit512 MB
Given n up to 10^18, find the smallest integer strictly greater than n whose decimal digits have no two adjacent equal digits.
- Level
Medium5 of 10
- Topics
- Greedy, Math, Implementation, String
- Solved
- No attempts yet
Problem
Senya likes integers that do not contain two consecutive equal digits. You are given an integer . Find the smallest integer he likes that is strictly greater than .
Input
The input contains an integer ().
Output
Print the smallest integer strictly greater than that does not contain any two consecutive equal digits.