시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB22619216687.368%

문제

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.

입력

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

출력

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

예제 입력 1

121 130

예제 출력 1

123

예제 입력 2

98766 100000

예제 출력 2

-1

노트

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.

출처

Contest > Codeforces > Codeforces Round 589 (Div. 2) A번