fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.  
  8. char s[1000];
  9. scanf("%s", s);
  10. int a[10];
  11. for(int i = 0; i < 10; i++){
  12. a[i] = 0;
  13. }
  14. for(int i = 0; i < strlen(s); i++) {
  15. if(s[i] >= '0' && s[i] <= '9') {
  16. a[(int)(s[i] - '0')]++;
  17. }
  18. }
  19. for(int i = 0; i < 10; i++){
  20. printf("%d ", a[i]);
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5440KB
stdin
a11472o5t6
stdout
0 2 1 0 1 1 1 1 0 0