fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int contaDigitos = 0, a, b;
  5. scanf("%d %d", &a, &b);
  6. while (b != 0) {
  7. if (b % 10 == a) contaDigitos++;
  8. b /= 10;
  9. }
  10. printf("%d\n", contaDigitos);
  11. return 0;
  12. }
Success #stdin #stdout 0s 9424KB
stdin
5 57565503
stdout
4