URAL 1723 Sandro's Book

#include <stdio.h>

char string[51];
int letterCount[26];

int main(){
	
	scanf("%s\n", string);
	int i;
	for (i = 0; string[i] != '\0'; i++)
		letterCount[string[i] - 'a']++;

	int maxCount = -1;
	int spell;
	for (i = 0; i < 26; i++)
		if (letterCount[i] > maxCount){
			maxCount = letterCount[i];
			spell = i;
		}

	printf("%c\n", spell + 'a');
	return 0;
}

你可能感兴趣的:(ACM,book,ural,1723,Sandros)