Rahul is a maths genius so he came up with a game and as raj is Rahul's best friend so Rahul decided to play the game with raj. Rahul gives raj two numbers LL and RR and asks raj to find the count of numbers in the range from LL to RR (LL and RR inclusive) which are a digit palindromic. A number is a digit palindromic if its first digit is the same as its last digit.
As raj is not very good at maths so your task is to help Raj find out how many numbers are a digit palindromic in the range LL to RR.
For example if LL = 88 and RR = 2525 .The following numbers are a digit palindromic in the range of LL to RR: 8, 9, 11, and 22.
If LL = 12511251 and RR = 12661266. The digit palindromic numbers are 1251 and 1261.
Input format
The first line contains an integer denoting the number of test cases.
Each test case is described by a single line that contains two integers LL and RR.
Output format
For each test case output, an integer denoting how many a digit palindromic numbers are there in the given range.
Constraints
1≤T≤5∗1041≤T≤5∗104 1≤l≤r≤10181≤l≤r≤1018.
Time Limit
1 second
Example
Input
3 8 25 1251 1266 12 21
Output
4 2 0
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
- the odd numbers are the numbers in the sequence 1,3,5,7,9, .... Define the sequence of S - numbers as follows: the first S - number is 1 The second S - number is the sum of the first S - number and the second odd number the third s - number is the sum of the second S- number and the third odd number. the fourth S- number is the sum of the third S- number and the fourth odd number, etc..,... compute the first seven S- numbers. make a note of any patterns you notice. enter the first seven S- numbers as a comma - seperated list: first seven S- numbers = ________________arrow_forwardIn a parking lot sequence, a nissan is placed after every five Mitsubishi cars. If the parking number is represented by a positive integer starting from one (1). Find the sum of all the parking number taken by the nissan cars if there is a total of 51 nissan cars in the parking lot.arrow_forwardHelp me pleasearrow_forward
- Given a sequence of numbers = 1 19 0 2 17 13 0 14 6 12 13, if you are going to percolate down from the 3rd number , the sequence becomes what?arrow_forwardComputer Science You must count the number of strings of length 6 over the alphabet A = {x, y, z}. Any string of length 6 can be considered as a 6-tuple. For example, the string xyzy can be represented by the tuple (x,y,z,y). So the number of strings of length 6 over A equals the number of 6-tuples over A, which by product rule is N. Find N. (Use the following product rule for any finite set A and any natural number n : |A^n|=|A|^n)arrow_forwardUsing C language Write a program to generate a table of powers of integers. For each integer compute its powers from 1 to 6. Print the powers of integers from 2 to 10.arrow_forward
- let n = 1*3*5*....*197*199 (the product of first 100 odd numbers) find the last 2 digits of narrow_forwardThere is more than one way to calculate the value of T. One way that this can be done is by generating random numbers. This works by recognizing that if you take a unit square that you can draw a quarter circle of unit radius inside the square. The area of the quarter circle is exactly π/4 and the area of the square is 1. So if you randomly generate a pair of uniform numbers between 0 and 1 they will be distributed uniformly across the square. If you count the total number of points generated and the number of points (x, y) where x² + y² = ² < 1 then the ratio of those two numbers will tend towards the ratios of the areas of the square and the circle as the number of points generated increases. The ratio of the areas is just π/4 so if you take that ratio and multiply it by 4 you get an estimate for . a) b Write code to estimate π using this method. You can generate random numbers in the range 0arrow_forwardLanguage - Java Generate 5000 random numbers in the range of [-16 to +16] both values are inclusive. Find and print the average of all of these 5000 random numbers.arrow_forwardarrow_back_iosarrow_forward_ios
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education