hdu2027

http://acm.hdu.edu.cn/showproblem.php?pid=2027

 1 #include<iostream>
 2 #include<stdio.h>
 3 #include<math.h>
 4 #include<stdlib.h>
 5 #include<string.h>
 6 #include<algorithm>
 7 using namespace std;
 8 
 9 int main()
10 {
11     //freopen("in.txt","r",stdin);
12     int n;
13     char s[110];
14     scanf("%d",&n);
15     getchar();
16     while(n--)
17     {
18         gets(s);
19         int len=strlen(s);
20         int a=0,e=0,i=0,o=0,u=0;
21         for(int j=0;j<len;j++)
22         {
23             if(s[j]=='a')
24             a++;
25             else if(s[j]=='e')
26             e++;
27             else if(s[j]=='i')
28             i++;
29             else if(s[j]=='o')
30             o++;
31             else if(s[j]=='u')
32             u++;
33         }
34         printf("a:%d
",a);
35         printf("e:%d
",e);
36         printf("i:%d
",i);
37         printf("o:%d
",o);
38         printf("u:%d
",u);
39         if(n!=0)
40         printf("
");
41     }
42     return 0;
43 }
原文地址:https://www.cnblogs.com/xuesen1995/p/4907269.html