Count a Digit in a Number
Count how many times a chosen digit appears in a number.
Input format
A single line with two integers N (N >= 0) and D (0 <= D <= 9).
Output format
Print how many times the digit D appears in N. If N is 0, its only digit is 0.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
0 0Expected output
1Example 2
Input
1223 2Expected output
2