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>
#include<iomanip>
//#include<bits/stdc++.h>
#include<cstdio>
#include<cmath>
#include<sstream>
#define PI 3.14159265358979
#define LL long long
#define eps 0.00000001
#define LL long long
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
char c[];
int T;
cin>>T;
getchar();//吸收回车
while(T--)
{
gets(c);
stringstream ss(c);//复制
string s;int sum1=,sum2=,sum3=,sum4=,sum5=;
while(ss>>s)//ss->s
{
int l=s.size();
for(int i=;i<l;++i)
{
if(s[i]=='a') ++sum1;
if(s[i]=='e') ++sum2;
if(s[i]=='i') ++sum3;
if(s[i]=='o') ++sum4;
if(s[i]=='u') ++sum5;
}
}
cout<<"a:"<<sum1<<endl;
cout<<"e:"<<sum2<<endl;
cout<<"i:"<<sum3<<endl;
cout<<"o:"<<sum4<<endl;
if(T!=) cout<<"u:"<<sum5<<endl<<endl;
else cout<<"u:"<<sum5<<endl;
}
}

统计元音(stringstream的-应用)的更多相关文章

  1. ytu 1939:统计元音(水题)

    统计元音 Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 68  Solved: 33[Submit][Status][Web Board] Descrip ...

  2. HDOJ2027统计元音

    统计元音 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  3. hdu 2027 统计元音

    统计元音 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submi ...

  4. LeetCode 5216. 统计元音字母序列的数目(Java)DP

    5216. 统计元音字母序列的数目 给你一个整数 n,请你帮忙统计一下我们可以按下述规则形成多少个长度为 n 的字符串: 字符串中的每个字符都应当是小写元音字母('a', 'e', 'i', 'o', ...

  5. HDOJ 2027 统计元音

    Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...

  6. HDU_2027——统计元音

    Problem Description 统计每个元音字母在字符串中出现的次数.   Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串.   Output ...

  7. HDU2027:统计元音

    Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...

  8. OpenJudge计算概论-求字母的个数(统计元音字母个数)

    /*======================================================================= 求字母的个数 总时间限制: 1000ms 内存限制: ...

  9. hdu 2027统计元音

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027 思路:主要考察gets()函数用法,能够接受输入的空格,如果用%s或是cin>>st ...

随机推荐

  1. jQuery UI vs Kendo UI & jQuery Mobile vs Kendo UI Mobile

    jQuery UI vs Kendo UI http://jqueryuivskendoui.com/#introduction jQuery Mobile vs Kendo UI Mobile ht ...

  2. OpenGL渲染流水线

    其实OpenGL的流水线,对我学习来说只能算是一个概念性的东西.毕竟OpenGL也在发展,流水线也不会是一成不变的. 不过理解流水线的过程,重点在于理解每一步的作用,进而可以如何衔接起来,完成整个绘制 ...

  3. 关于RandomizedSearchCV 和GridSearchCV(区别:参数个数的选择方式)

    # -*- coding: utf-8 -*- """ Created on Tue Aug 09 22:38:37 2016 @author: Administrato ...

  4. When install ”matplotlib” with ”pip”, if you get the following error, it means the “freetype” and “png” libraries needed by matplotlib are not installed:

    ============================================================================ * The following require ...

  5. scrapy xpath 节点关系

    父节点 子节点 兄弟节点 先辈节点 后代节点

  6. Shell编程进阶 1.7 case选择

    逻辑判断的格式 vim case.sh #!/bin/bash read -p "please input a number:" n m=$[$n%] case $m in ) e ...

  7. python爬虫--编码问题y

    1)中文网站爬取下来的内容中文显示乱码 Python中文乱码是由于Python在解析网页时默认用Unicode去解析,而大多数网站是utf-8格式的,并且解析出来之后,python竟然再以Unicod ...

  8. Android屏幕适配终结者

    1,http://blog.csdn.net/zhengjingle/article/details/51742839 github : https://github.com/zhengjingle/ ...

  9. java中一些常用的英语

     abstract (关键字  ) 抽象  ['.bstr.kt]  access vt.访问,存取  ['.kses]'(n.入口,使用权)  algorithm n.算法  ['.lg.rie ...

  10. nodejs安装配置

    1.安装node.js(6.3.0)2.检测PATH环境变量是否配置了Node.jscmd下node --version3.D:/www/nodejs文件夹下创建hello.jsvar http = ...