HDU2027_统计元音
2016-11-19 17:20
357 查看
统计元音
http://acm.hdu.edu.cn/showproblem.php?pid=2027Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 64154 Accepted Submission(s): 25380
Problem Description
统计每个元音字母在字符串中出现的次数。
Input
输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串。
Output
对于每个测试实例输出5行,格式如下:
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
Sample Input
2
aeiou
my name is ignatius
Sample Output
a:1
e:1
i:1
o:1
u:1
a:2
e:1
i:3
o:0
u:1
Author
lcy
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n = 0, i = 0, j = 0, num[1100] = { 0 }; char str[1100] = { 0 },rub; scanf("%d%c", &n,&rub); for (j = 0;j<n;j++) { memset(str, 0, sizeof(str)); memset(num, 0, sizeof(num)); gets(str); for (i = 0;i < strlen(str);i++) { if (str[i] == 'a') num[0]++; if (str[i] == 'e') num[1]++; if (str[i] == 'i') num[2]++; if (str[i] == 'o') num[3]++; if (str[i] == 'u') num[4]++; } printf("a:%d\n", num[0]); printf("e:%d\n", num[1]); printf("i:%d\n", num[2]); printf("o:%d\n", num[3]); printf("u:%d\n", num[4]); if (j != n - 1) printf("\n"); } return 0; }
相关文章推荐
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU_2027 统计元音
- hdu 2027 统计元音
- hdu 2027 统计元音
- hdu-2027-统计元音
- HDU 2027 统计元音
- HDU-2027元音统计
- HDU-2027 统计元音 一点点哈希思想
- HDU:2027 统计元音
- [hdu 2027] 统计元音
- HDU 2027 统计元音(水~)
- hdu 2027 统计元音
- HDU_2027——统计元音
- hdu 2027 统计元音
- HDU2027统计元音
- HDU 2027 统计元音
- HDU_2027 统计元音
- HDU——2027 ——统计元音
- HDU 2027 统计元音 (吃回车的方法)