统计元音

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

#include<iostream>
int main()
{
using namespace std;
char st[]="\0";
unsigned short count;
cin>>count; cin.get();
while(count--)
{ unsigned short yuy[]={}; gets(st); for(int i=;st[i];++i)
switch(st[i])
{
case 'a':++yuy[];break;
case 'e':++yuy[];break;
case 'i':++yuy[];break;
case 'o':++yuy[];break;
case 'u':++yuy[];break;
}
cout<<"a:"<<yuy[]<<endl
<<"e:"<<yuy[]<<endl
<<"i:"<<yuy[]<<endl
<<"o:"<<yuy[]<<endl
<<"u:"<<yuy[]<<endl;
if(count)
cout<<endl;
} return ;
}

ACM2027的更多相关文章

随机推荐

  1. LED字符设备驱动实例及测试代码

    驱动代码如下: #include <linux/kernel.h>//内核头文件 #include <linux/init.h>//__init等 #include <l ...

  2. 【加密】RSA加密之实现

    private void btn_RSA_Click(object sender, EventArgs e) { //第一种方法调用 this.textBox1.Text = RSAEncrypt(& ...

  3. STL容器的本质

    http://blog.sina.com.cn/s/blog_4d3a41f40100eof0.html 最近在学习unordered_map里面的散列函数和相等函数怎么写.学习过程中看到了一个好帖子 ...

  4. Python创建list

    Python内置的一种数据类型是列表:list.list是一种有序的集合,可以随时添加和删除其中的元素. 比如,列出班里所有同学的名字,就可以用一个list表示: >>> ['Mic ...

  5. xcode 中添加pch文件

    xcode6以后去掉了pch文件,据说苹果是觉得把头文件加在pch中,会让编译变慢,但是作为我们程序员来说难不倒我们,所以我们手动来添加一下pch文件即可   首先创建一个工程,然后创建一个pch文件 ...

  6. hdu 1754 I Hate It (模板线段树)

    http://acm.hdu.edu.cn/showproblem.php?pid=1754 I Hate It Time Limit: 9000/3000 MS (Java/Others)    M ...

  7. ***PHP多线程pthreads 实现QQ号码爬虫

    通过空间历史浏览,爬出查看你空间的人(一般限制20人,除非开通黄钻),然后在爬出这20人的浏览记录,依次向下爬,你可以控制爬行深度.这里仅仅给出怕中代码片段,你可以进一步优化,将QQ分类存储.通过QQ ...

  8. HDU1395+快速幂

    #include<stdio.h> int fast_pow( int a,int b,int mod ){ ; ){ == ){ res = res*a%mod; } a = a*a%m ...

  9. minicom installation and configuration on ubuntu

    minicom是一个串口通信工具,就像Windows下的超级终端,可用来与串口设备通信.minicom完全通过键盘实现操作. install sudo apt-get install minicom ...

  10. android usb host 读写USB设备

    自android3.1以后android增加了操作USB设备的API. 官网地址:http://developer.android.com/guide/topics/connectivity/usb/ ...