Programming contests

DEIK Regionális Programozó Csapatverseny, egyetemi kategória, 2022. december 4.

December 4, 2022 10:00 AM – December 4, 2022 3:15 PM

stepping

An integer (represented in base 10) is called stepping if the adjacent digits have absolute difference of 1. Any single digit number is stepping by definition. For example: each of the numbers 9,123,321,101,676 is stepping, but none of 42,122,329,111,69654 is. Compute all of the stepping numbers in the interval [A,B]!

Example

A=10
B=20
It is easy to see that except 10,12 there are no more stepping 
numbers in the interval.

Input Specification

A B

A single line with space separated the integers 1 ≤ A ≤ B ≤ 2*109 .

Output Specification


[s1,...,sk]

A line with the comma searated, square bracket enclosed list of stepping numbers. The numbers must be in increasing order!

Sample Input 1

  1. 10 20
download as text file

Sample Output 1

  1. [10,12]
download as text file

Sample Input 2

  1. 100 300
download as text file

Sample Output 2

  1. [101,121,123,210,212,232,234]
download as text file

Sample Input 3

  1. 99 100
download as text file

Sample Output 3

  1. []
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019