You are viewing a single comment's thread. Return to all comments →
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */ char str[1000]; int count[10] = {0}; fgets(str, sizeof(str), stdin); str[strcspn(str, "\n")] ='\0'; for(int i=0; i<strlen(str); i++){ if(str[i] >= '0' && str[i]<= '9'){ int digit = str[i] - '0'; count[digit]++; } } for (int k=0; k<10; k++){ printf("%d ", count[k]); } return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Digit Frequency
You are viewing a single comment's thread. Return to all comments →
int main() {
}