http://acm.hdu.edu.cn/showproblem.php?pid=1020 #include<stdio.h> const int MAX = 10008; char s[MAX]; int main() { int T; scanf("%d", &T); while(T--) { int count = 1, i; scanf("%s", s); for(i=0; s[i]; ++i) { if(s[i] == s[i+1]) { count++; } else { if(count != 1) printf("%d", count); printf("%c", s[i]); count = 1; } } printf("/n"); } return 0; } http://acm.hdu.edu.cn/showproblem.php?pid=1039 #include<stdio.h> #include<string.h> const int MAX = 28; char s[MAX]; int isVowel(char ch) { if('a'==ch || 'e'==ch || 'i'==ch || 'o'==ch || 'u'==ch) return 1; return 0; } int f(char s[]) { int num = 0; for(int i = 0; s[i]; ++i) { if( isVowel(s[i]) ) num++; if((isVowel(s[i]) && isVowel(s[i+1]) && isVowel(s[i+2])) ||(!isVowel(s[i]) && !isVowel(s[i+1]) && !isVowel(s[i+2]) && s[i+2] != '/0') ||(s[i] == s[i+1] && s[i] != 'e' && s[i] != 'o')) { return 0; } } if(num) return 1; return 0; } int main() { while(scanf("%s", s) != EOF) { if(0==strcmp("end", s)) break; int len = strlen(s); s[len+1] = 'i';//选个元音 s[len+2] = 'j';//选个非元音 if(f(s)) printf("<%s> is acceptable./n", s); else printf("<%s> is not acceptable./n", s); } return 0; }