P27784 [洛谷] Digit Count
普及-
题目描述

Problem Description

Please count the number of times the digit $2$ appears in all integers within a given range $[L, R]$.

For example, given the range $[2, 22]$, the digit $2$ appears once in the number $2$, once in the number $12$, once in the number $20$, once in the number $21$, and twice in the number $22$. Therefore, the digit $2$ appears a total of $6$ times within this range.

Input Format

The input consists of a single line containing two positive integers $L$ and $R$, separated by a space.

Output Format

The output consists of a single line indicating the number of times the digit $2$ appears.

Sample Input and Output

Sample Input #1

2 22

Sample Output #1

6

Sample Input #2

2 100

Sample Output #2

20

Notes

$1 < L, R < 10000$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 22
样例输出
6