Digit Count
InterviewTime limit1sMemory limit1024 MB
Given a range of 4-digit integers and a digit from 0 to 9, count how many times that digit appears across all numbers in the range.
- Level
Easy2 of 10
- Topics
- Implementation, Brute force
- Solved
- No attempts yet
Problem
There are many ways to count the frequencies of letters. Can the same methods be applied to digits?
Given a range (two integers) and a digit (0-9), count how many times the digit occurs in the range.
Input
There is one input line. It contains the two integers that form the range and the digit. Each integer of the range is between 1000 and 9999 (inclusive), and the digit is between 0 and 9 (inclusive). The first integer of the range is not greater than the second integer.
Output
Print the number of occurrences of the digit in the given range.