#arc131a. [arc131_a]Two Lucky Numbers
[arc131_a]Two Lucky Numbers
Problem Statement
Mr. AtCoder reads in the newspaper that today's lucky number is a positive integer and tomorrow's is a positive integer .
Here, he defines a positive integer that satisfies both of the following conditions as a super-lucky number.
- The decimal notation of contains as a contiguous substring.
- The decimal notation of contains as a contiguous substring.
Actually, under the Constraints of this problem, there is always a super-lucky number less than . Find one such number.
Constraints
- and have no leading
0
s. - All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print one super-lucky number less than . If multiple solutions exist, you may print any of them.
Sample Input 1
13
62
Sample Output 1
131
One super-lucky number is , because:
- contains as a substring. (-st through -nd characters)
- contains as a substring. (-nd through -rd characters)
Some other super-lucky numbers are , , and , which would also be accepted.
Sample Input 2
69120
824
Sample Output 2
869120
One super-lucky number is , because:
- contains as a substring. (-nd through -th characters)
- contains as a substring. (-th through -th characters)
The smallest super-lucky number is , but note that any lucky number with at most digits would be accepted.
Sample Input 3
6283185
12566370
Sample Output 3
6283185
When , is itself, and is itself. In such a case too, is a super-lucky number.