#K88977. Counting Palindromic Numbers in a Range
Counting Palindromic Numbers in a Range
Counting Palindromic Numbers in a Range
You are given T test cases. For each test case, you are given two integers l and r.
Your task is to count how many integers between l and r (inclusive) are palindromic. A number is called palindromic if it reads the same backwards as forwards. For example, \(121\) and \(22\) are palindromic, while \(123\) is not.
Input/Output Format: The problem uses standard input and output. Read input from stdin
and write your results to stdout
.
inputFormat
The first line of input contains an integer T (1 \(\leq\) T \(\leq\) 100), the number of test cases.
Each of the next T lines contains two space-separated integers l and r (1 \(\leq\) l \(\leq\) r \(\leq\) 105), representing the range for each test case.
outputFormat
For each test case, output a single integer on a new line representing the count of palindromic numbers between l and r (inclusive).
## sample3
1 10
100 200
10 100
9
10
9
</p>