You are viewing a single comment's thread. Return to all comments →
My solution
#include <stdio.h> #include <stdlib.h> int main() { char *s = (char*)malloc(1000*sizeof(char)); int i=0,arr[10] = {0}; scanf("%[^\n]",s); while(s[i] != '\0'){ if((s[i] - '0')<=9) arr[(s[i]- '0')]++; ++i; } for(i=0;i<=9;i++){ printf("%d ", arr[i]); } 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 →
My solution