http://acm.sgu.ru/problem.php?contest=0&problem=460
将单数形式的单词变为复数然后输出
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(void) {
int n;
scanf ("%d", &n);
int i;
char word[30];
int len;
for (i = 0; i < n; ++i) {
bool es = true;
scanf ("%s", word);
len = strlen(word);
if ((word[len-1] == 'h' && word[len-2] == 'c') ||
word[len-1] == 'x' || word[len-1] == 's' || word[len-1] == 'o') {
/*blank line*/
} else if (word[len-1] == 'f') {
word[len-1] = 'v';
} else if (word[len-1] == 'e' && word[len-2] == 'f') {
word[len-2] = 'v';
word[len-1] = '\0';
} else if (word[len-1] == 'y') {
word[len-1] = 'i';
} else {
es = false;
}
printf ("%s", word);
if (es) {
printf ("es\n");
} else {
printf ("s\n");
}
}
return 0;
}