You are viewing a single comment's thread. Return to all comments →
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> int main() { char s[1001]; int a[10] = {0}; scanf("%1001s",s); for(int i = 0; i < strlen(s); ++i) { if (isdigit(s[i])) { int kk = s[i] - 48; a[kk] += 1; } else { continue; } } for(int i = 0; i < 10; ++i){ printf("%d ",a[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 →