13. 가장 많이 사용된 자릿수

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include <stdlib.h> int main(void) { int max = -1000; int res = 0; int count[10] = {0}; char checkNumber[101]; scanf("%s", checkNumber); for (int i = 0; checkNumber[i] != '\0'; i++) { count[checkNumber[i] - 48]++; } for (int i = 0; i < 10; i++) { if (max < count[i]) { max = count[i]; res = i; } else if (max == count[i]) { res = i; } } printf("%d\n", res); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines