#23. Magic Year 1

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: syzoj

题目描述

A magic year is defined that a year number is a palindrome. For example, Year 1881, 1991, and 2002 are magic years while 110, 122, and 1222 are not.

As we all know, YHZ born in 1997, he also missed the year 1991, which is also a magical year. It is unusual for a man who can experience 2 magical years for post-80s who lives until 2002 at least. Therefore, he wants to know, if the life of a man can be extended, how many magical years he can experience. For idealization of the design, you may consider the life of a man can up to million even billion years.

输入格式

The input contains multiple cases. The first line, a number T . The following T lines, each line contains two numbers x and y .

输出格式

For each case, output the number of magic years between Year x and y inclusive.

样例

Sample Input

1
1644 2021

输出样例

5

数据范围与提示

Those magical years are 1661, 1771, 1881, 1991, and 2002.