Strong Number

2

2 votes
Problem

Ram is very strange person, so every day he has a new stunning number. But since its only one, in case he needs multiple numbers, he came up with the definition of “Strong Stunning Number”.
A number is called a Strong Stunning Number if it ends with Rams Stunning number.
So for example, if Ram’s stunning number is 25, then Strong Stunning number would be625, 11225 and 25 whereas 5 and 2255 are not.
Write a program for Ram that will report how many Strong Stunning numbers are available not exceeding M.


Input:
The only line of the input file contains two integers N and M, where N is Ram’s Stunning number.


Output:
Print the count of Strong Stunning Numbers not exceeding M.


Constraints:
1<=N<=M<=2109

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?