统计元音

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

 1 #include <stdio.h>
 2 #include <string.h>
 3 #include <stdlib.h>
 4 int main()
 5 {
 6     int n;
 7     char a[102];
 8     scanf("%d",&n);
 9     getchar();
10     while(n--)
11     {
12         gets(a);
13         int l=strlen(a);
14         int b[256];
15         memset(b,0,sizeof(b));
16         char hash[]={'a','e','i','o','u'};
17         for(int i=0;i<l;i++)
18         {
19             b[a[i]]++;
20         }
21         for(int i=0;i<5;i++)
22         {
23             printf("%c:%d\n",hash[i],b[hash[i]]);
24         }
25 
26           if(n>0)
27             printf("\n");
28     }
29     return 0;
30 }

 

posted @ 2014-06-30 16:08  人艰不拆_zmc  阅读(192)  评论(0编辑  收藏  举报