배열 - 배열 수행평가13(가장많이사용된문자는?)

2018. 7. 8. 11:42algorithm/dimigo.goorm.io

#include <stdio.h>

#include <string.h>


int main() {

char arr[1000];

int i, j;

int solve[1000];

int result = 0;

int tmp;


scanf("%s", arr);

for (i = 0; i < strlen(arr); i++) {

solve[arr[i]]++;

}

for (i = 97; i < 123; i++) {

if (result < solve[i]) {

result = solve[i];

tmp = i;

}

}

printf("%c", tmp);


}