#arc142a. [arc142_a]Reverse and Minimize
[arc142_a]Reverse and Minimize
Problem Statement
For a positive integer , let be the answer to the question below.
The following operation on can be performed zero or more times.
- Let be the integer obtained by reversing the decimal notation of . Then, replace with . If now has one or more leading zeros, delete them so that it begins with a non-zero digit.
For example, from , you get after one operation, after two operations, and after three operations.
Find the minimum possible value of after operations.
Find the number of integers such that and .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
1420 142
Sample Output 1
3
Three integers , , and satisfy and .
Sample Input 2
1419 142
Sample Output 2
2
Sample Input 3
6 19
Sample Output 3
0