First and Last Digits
Given two integers M and N, write a program to count of the numbers which have the same first and last digits in the given range M to N (inclusive of M and N).
Input
The first line of input will contain a positive integer M.
The second line of input will contain a positive integer N.
Output
The output should be an integer denoting the count of the numbers in the range which meet the given condition.
Explanation
For example, if the given numbers are M is 5 and N is 30, the numbers which have the first and last digit equal in the given range (5, 6, ..., 29, 30) are 5, 6, 7, 8, 9, 11 and 22. So the output should be 7.
Sample Input 1
5
30
Sample Output 1
7
Sample Input 2
1
10
Sample Output 2
9
Comments
Leave a comment