SDE Path

Count a Digit in a Number

Easy

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 0
Expected output
1
Example 2
Input
1223 2
Expected output
2