Show one task per page / all tasks on one page
|Time limit||1 second|
|Memory limit||256 megabytes|
Let us call the integer number a bit palindromic, if its first digit is the same as its last digit. We use decimal notation without leading zeroes. Your task is to count how many a bit palindromic numbers are there between l and r, inclusive.
The following numbers are a bit palindromic in the first sample test: 8, 9, 11, and 22.
The numbers in the second sample test — 1251 and 1261.
Input data contains multiple test cases. The first line contains one integer t — the number of test cases (1 ≤ t ≤ 5·104).
Each test case is described by a single line that contains two integers: l and r (1 ≤ l ≤ r ≤ 1018).
For each test case output one integer: how many a bit palindromic numbers are there in the given range.
3 8 25 1251 1266 12 21
4 2 0