#P11680. First, Middle, and Last Equal Numbers

    ID: 13771 Type: Default 1000ms 256MiB

First, Middle, and Last Equal Numbers

First, Middle, and Last Equal Numbers

A positive integer \(X\) is called a first, middle, and last equal number if and only if it satisfies the following conditions:

  • \(X\) has an odd number of digits.
  • The digit at the first position, the middle position, and the last position of \(X\) are equal.

For example, \(12131\) is a first, middle, and last equal number, but \(121121\) and \(12231\) are not. Note that any one-digit number is considered a first, middle, and last equal number.

Given two integers \(L\) and \(R\), find and output all the first, middle, and last equal numbers in the interval \([L, R]\).

inputFormat

The input consists of a single line containing two integers \(L\) and \(R\) separated by a space.

outputFormat

Output all the numbers in the interval \([L, R]\) that satisfy the condition. The numbers should be printed in increasing order and separated by a single space. If there is no such number, output an empty line.

sample

1 20
1 2 3 4 5 6 7 8 9