import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a number : ");
long num = in.nextLong();
System.out.print("Enter a digit : ");
int digit = in.nextInt();
int count = 0;
long rem;
while(num != 0){
rem = num % 10;
if(rem == digit){
count++;
}
num /= 10;
}
System.out.println(digit + " is occured " + count + " times.");
}
}