Read two natural numbers n and d, where d is a digit
(0 <= d <= 9). Determine how many times digit d appears in the
decimal representation of n.
Read two natural numbers n and d, where d is a digit
(0 <= d <= 9). Determine how many times digit d appears in the
decimal representation of n.
The program reads from standard input two natural numbers, `n` and `d`, separated by a space. - `0 <= n <= 1000000000` - `0 <= d <= 9` - the number `0` has exactly one digit (the digit `0`)
The program prints a single natural number: the number of occurrences of digit `d` in `n`, followed by a newline.
1223344 3
2
Use the Get Hint button in the action bar to reveal a guided hint.
No comments yet. Be the first to start the discussion!
1223344 3
2
Community solutions unlock after you submit a passing solution. Don't peek.
Create a free account to write code, submit solutions, and track your progress.