#include
#include
#include
#define MAXSIZE 36
struct Word {
char word[MAXSIZE];
unsigned size;
}words[10000];
int n = 0;
void Sort() {
// 没有时间写了
}
void Additive(char word[]) {
int i,flag = 1;
for(i = 0; i < n && flag; ++i) {
if(strcmp(words[i].word,word) == 0) {
++words[i].size;
flag = 0;
}
}
if(flag) {
strcpy(words[n].word,word);
words[n].size = 1;
++n;
}
}
int main() {
int i,ch;
char word[MAXSIZE];
FILE *fin = fopen("case1.in","rt");
if(fin == NULL) {
printf("无法打开数据文件!\n");
return 1;
}
i = 0;
while((ch = fgetc(fin)) != EOF) {
if(isalpha(ch)) word[i++] = tolower(ch);
else if(i) {
word[i] = '\0';
i = 0;
Additive(word);
}
}
if(i) {
word[i] = '\0';
Additive(word);
}
fclose(fin);
Sort();
return 0;
}