hdu-统计元音
来源:互联网 发布:清理mac系统垃圾软件 编辑:程序博客网 时间:2024/05/17 02:46
http://acm.hdu.edu.cn/showproblem.php?pid=2027
Problem Description
统计每个元音字母在字符串中出现的次数。
Input
输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串。
Output
对于每个测试实例输出5行,格式如下:
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
Sample Input
2aeioumy name is ignatius
Sample Output
a:1e:1i:1o:1u:1a:2e:1i:3o:0u:1
分析:
#include <iostream>#include <cstring>#include <cstdio>using namespace std;int main(){ char a[200]; int len,n; int num1,num2,num3,num4,num5,p=0; cin>>n; int m=n; getchar(); while(n--) { num1=0; num2=0; num3=0; num4=0; num5=0; int j; gets(a); len=strlen(a); for(j=0;j<len;j++) { if(a[j]=='a') { num1++; } if(a[j]=='e') { num2++; } if(a[j]=='i') { num3++; } if(a[j]=='o') { num4++; } if(a[j]=='u') { num5++; } } p++; cout<<"a:"<<num1<<endl; cout<<"e:"<<num2<<endl; cout<<"i:"<<num3<<endl; cout<<"o:"<<num4<<endl; cout<<"u:"<<num5<<endl; if(p<m) cout<<endl; } return 0;}
- hdu 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- Hdu 2027 - 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- hdu-统计元音
- HDU 2027 - 统计元音
- hdu-2027-统计元音
- [hdu 2027] 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- HDU 2027 统计元音
- 【HDU】统计元音
- hdu 2027 统计元音
- HDU 2027 -- 统计元音
- 一大坨GoogleAPI的学习笔记之二(oAuth2.0总结)
- iptables学习 01
- hdu - 4627 - The Unsolvable Problem
- Cocos2D-iphone CCLayer中的两种触摸(touch)处理方式
- Sftp和ftp 区别、工作原理等(汇总ing)
- hdu-统计元音
- CodeForces-MemSQL start[c]up Round 1-A. Square and Rectangles
- Starling在应用于移动设备开发时的注意事项
- 半透明Panel控件问题
- 专业学习中,学、用英语
- hdu-Palindromes _easy version
- 学生信息管理系统之模棱两可
- python join
- 项目中使用XML方式去取数据插入数据代码