Codeforces Round 589 (Div. 2)
A
Distinct Digits
Codeforces
800
原题
←B →
翻译中…

You have two integers $l$ and $r$. Find an integer $x$ which satisfies the conditions below:

翻译中…
  • $l \le x \le r$.
  • All digits of $x$ are different.
翻译中…

If there are multiple answers, print any of them.

翻译中…

Input

翻译中…

The first line contains two integers $l$ and $r$ ($1 \le l \le r \le 10^{5}$).

翻译中…

Output

翻译中…

If an answer exists, print any of them. Otherwise, print $-1$.

翻译中…

Note

翻译中…

In the first example, $123$ is one of the possible answers. However, $121$ can't be the answer, because there are multiple $1$s on different digits.

翻译中…

In the second example, there is no valid answer.

翻译中…

样例

Input #1
121 130
Output #1
123
InputCopy OutputCopy
Input #2
98766 100000
Output #2
-1
InputCopy OutputCopy
题目信息
题号
1228A
时间限制
1 s
内存限制
256 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。