#t56. 统计数字出现次数

统计数字出现次数

Count Digit Occurrences

Problem Background

Corresponding multiple-choice / true-false question: https://ti.luogu.com.cn/problemset/1150

Problem Description

Xiao Yang believes his lucky number is the positive integer kk (it is guaranteed that 1≤k≤91 \le k \le 9). Xiao Yang wants to know how many times kk appears among all positive integers from 11 to nn.

Input Format

The first line contains a positive integer nn.

The second line contains a positive integer kk.

Output Format

Output the number of times kk appears among all positive integers from 11 to nn.

Sample Input

25
2

Sample Output

9

Sample Explanation

From 11 to 2525, the positive integers in which 22 appears are 2,12,20,21,22,23,24,252, 12, 20, 21, 22, 23, 24, 25, for a total of 99 occurrences.

Constraints

For all test data, it is guaranteed that 1≤n≤10001 \le n \le 1000 and 1≤k≤91 \le k \le 9.