#K59722. Count Palindromic Numbers

    ID: 30928 Type: Default 1000ms 256MiB

Count Palindromic Numbers

Count Palindromic Numbers

In this problem, you are given two integers a and b representing the lower and upper bounds of an interval, respectively. Your goal is to count how many numbers in the interval \([a, b]\) (inclusive) are palindromic. A number is considered palindromic if its decimal representation reads the same forwards and backwards. Formally, a number \(n\) is palindromic if:

\(n = reverse(n)\)

For example, \(121\) is palindromic because reversing its digits yields \(121\), but \(123\) is not palindromic since \(123 \neq 321\).

inputFormat

The input consists of two space-separated integers:

  • a: the beginning of the interval.
  • b: the end of the interval.

You can assume that a and b are such that \(1 \leq a \leq b \leq 10^6\).

outputFormat

Output a single integer that represents the count of palindromic numbers within the interval \([a, b]\).

## sample
1 10
9

</p>