fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main(void)
  6. {
  7. int c, i, nwhite, nother;
  8. int ndigit[10];
  9.  
  10. nwhite = nother = 0;
  11. for (i = 0; i < 10; i++)
  12. ndigit[i] = 0;
  13.  
  14. while (( c = getchar()) != EOF){
  15. if
  16. (c >= '0' && c <= '9')
  17. ++ndigit[c-'0'];
  18.  
  19. else if
  20. (c == ' ' || c == '\t' || c == '\n')
  21. ++nwhite;
  22.  
  23. else
  24. ++nother;
  25. }
  26.  
  27. printf("digits =");
  28. for (i = 0; i < 10; i++)
  29. printf(" %d", ndigit[i]);
  30. printf(", white space = %d, other = %d\n", nwhite, nother);
  31. }
  32.  
Success #stdin #stdout 0s 2732KB
stdin
adskjfjasd90fj9asdfj9sad90jf
stdout
digits = 2 0 0 0 0 0 0 0 0 4, white space = 0, other = 22