Uploaded by subhajitchakraborty509867

source code of c

advertisement
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char* s;
s = (char*)malloc(1000 * sizeof(char));
scanf("%s", s);
int length = strlen(s);
//printf("%d", length);
for (int i = 0; i < 10; i++) {
int count = 0;
char strnum[10];
sprintf(strnum, "%d", i);
for (int j = 0; j < length; j++) {
if (*(s+j) == *strnum) {
count++;
}
}
printf("%d ", count);
}
return 0;
}
Download