http://acm.hdu.edu.cn/showproblem.php?pid=2027
这道题注意格式,我提交了三次,前两次都是PE错误。原因就是没注意到
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行的要求。。。
#include<stdio.h>
#include<string.h>
int main(){
int n;
char ch[100];
scanf("%d",&n);
getchar();
int num_a,num_e,num_i,num_o,num_u;
while(n--){
gets(ch);
num_a=0;
num_e=0;
num_i=0;
num_o=0;
num_u=0;
int len=strlen(ch);
for(int i=0;i<len;i++){
switch(ch[i]){
case 'a': num_a++; break;
case 'e': num_e++; break;
case 'i': num_i++; break;
case 'o': num_o++; break;
case 'u': num_u++; break;
}
}
printf("a:%d\ne:%d\ni:%d\no:%d\nu:%d\n",num_a,num_e,num_i,num_o,num_u);
if(n) printf("\n");
}
}