#C9009. Count the Occurrence of a Digit
Count the Occurrence of a Digit
Count the Occurrence of a Digit
You are given a number n
represented as a string, and a single digit d
(also given as a string). Your task is to count the number of times the digit d
occurs in the string representation of n
.
Note: The input is provided via standard input (stdin) with n
on the first line and d
on the second line. The output should be printed to standard output (stdout) as a single integer.
For example:
Input: 123456789 3</p>Output: 1
The problem tests your ability to handle string manipulation and counting specific characters efficiently.
inputFormat
The input consists of two lines. The first line contains the string n
representing the number. The second line contains the single digit d
that you need to count in n
.
Constraints: n
can be a large number and may include leading zeros.
outputFormat
Output a single integer indicating the number of times the digit d
appears in the string n
.
123456789
3
1