杭电ACM 2027 统计元音

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");
	}
}


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值