Numbers That Contain D
How many integers in [1, N] contain the digit D at least once?
Input: one line with two integers N and D.
Output: the count of integers containing D.
Constraints:
- 1 ≤ N ≤ 1018
- 0 ≤ D ≤ 9
Sample Tests
Input 1
25 2
Output 1
8
Input 2
10 0
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.