标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 58391 Accepted Submission(s): 23254
1 #include <stdio.h> 2 #include <string.h> 3 int main(){ 4 int test; 5 int num_a,num_e,num_i,num_o,num_u; 6 scanf("%d", &test); 7 getchar();//特别注意,用一个getchar吃掉输入测试组数后的那个回车,防止用gets或者getline时将回车当成字符串 8 while(test--){ 9 num_a=num_e=num_i=num_o=num_u=0; 10 char s[101]; 11 gets(s); 12 int len = strlen(s); 13 for(int i = 0; i < len; i++){ 14 switch(s[i]){ 15 case ‘a‘: num_a++; break; 16 case ‘e‘: num_e++; break; 17 case ‘i‘: num_i++; break; 18 case ‘o‘: num_o++; break; 19 case ‘u‘: num_u++; break; 20 } 21 } 22 printf("a:%d\ne:%d\ni:%d\no:%d\nu:%d\n",num_a,num_e,num_i,num_o,num_u); 23 if(test){ 24 printf("\n"); 25 } 26 27 } 28 return 0; 29 }
标签:
原文地址:http://www.cnblogs.com/qinduanyinghua/p/5559171.html