Server Time: Fri Oct 30, 2020 5:09 am
Welcome ( logout
H - Palindromic Numbers
PDF (English) Ranklist
Time Limit: 2 second(s) Memory Limit: 32 MB

A palindromic number or numeral palindrome is a 'symmetrical' number like 16461 that remains the same when its digits are reversed. In this problem you will be given two integers i j, you have to find the number of palindromic numbers between i and j (inclusive).


Input starts with an integer T (≤ 200), denoting the number of test cases.

Each case starts with a line containing two integers i j (0 ≤ i, j ≤ 1017).


For each case, print the case number and the total number of palindromic numbers between i and j (inclusive).

Sample Input

Output for Sample Input


1 10

100 1

1 1000

1 10000

Case 1: 9

Case 2: 18

Case 3: 108

Case 4: 198


Problem Setter: Jane Alam Jan
Developed and Maintained by
Copyright © 2012
LightOJ, Jane Alam Jan