统计数字出现的次数
#include <stdio.h>
int Count_Digit ( const int N, const int D )
{
int count=0;
int n=N>0?N:-N;
if(N!=0)
{ while (n>0)
{
if(n%10==D)
{
count=count+1;
}
n=n/10;
}
return count;
}
else
return 1;
}
int main()
{
int N, D;
scanf("%d %d", &N, &D);
printf("%d\n", Count_Digit(N, D));
return 0;
}