Codeforces Round 166 (Div. 2)
翻译中…
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
翻译中…
Now you are suggested to solve the following problem: given a year number, find the minimum year number which is strictly larger than the given one and has only distinct digits.
翻译中…
Input
翻译中…
The single line contains integer $*y*$ $(1000 ≤ *y* ≤ 9000)$ — the year number.
翻译中…
Output
翻译中…
Print a single integer — the minimum year number that is strictly larger than $*y*$ and all it's digits are distinct. It is guaranteed that the answer exists.
翻译中…
样例
Input #1
1987
Output #1
2013
InputCopy
OutputCopy
Input #2
2013
Output #2
2014
InputCopy
OutputCopy
题目信息
标签
暴力
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。