统计元音(stringstream的-应用)
a:num1
e:num2
i:num3
o:num4
u:num5
多个测试实例之间由一个空行隔开。
请特别注意:最后一块输出后面没有空行:)
aeiou
my name is ignatius
#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的-应用)的更多相关文章
- ytu 1939:统计元音(水题)
统计元音 Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 68 Solved: 33[Submit][Status][Web Board] Descrip ...
- HDOJ2027统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...
- hdu 2027 统计元音
统计元音 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- LeetCode 5216. 统计元音字母序列的数目(Java)DP
5216. 统计元音字母序列的数目 给你一个整数 n,请你帮忙统计一下我们可以按下述规则形成多少个长度为 n 的字符串: 字符串中的每个字符都应当是小写元音字母('a', 'e', 'i', 'o', ...
- HDOJ 2027 统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...
- HDU_2027——统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output ...
- HDU2027:统计元音
Problem Description 统计每个元音字母在字符串中出现的次数. Input 输入数据首先包括一个整数n,表示测试实例的个数,然后是n行长度不超过100的字符串. Output 对于每个 ...
- OpenJudge计算概论-求字母的个数(统计元音字母个数)
/*======================================================================= 求字母的个数 总时间限制: 1000ms 内存限制: ...
- hdu 2027统计元音
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2027 思路:主要考察gets()函数用法,能够接受输入的空格,如果用%s或是cin>>st ...
随机推荐
- Python函数(八)-装饰器(一)
装饰器通过函数来定义,用来装饰函数 装饰器的结构为高阶函数和内嵌函数 装饰器不改变被装饰函数的源代码和运行方式 如何实现这个效果呢? # -*- coding:utf-8 -*- __author__ ...
- Java中自动装箱代码初探
<深入理解Java虚拟机>中讲语法糖时,提到了下面这个例子(不是原文中的例子,我自己改过): public class AutoBoxingTest { /** * @param args ...
- 使用Eclipse中遇到的问题
1.解决eclipse中jsp没有代码提示问题 原因是项目没有关联TOMCAT库文件: 右键项目—> 属性->JAVA Build Path -> Add Library->S ...
- java.sql.SQLException: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
执行Hive查询: Console是这样报错的 java.sql.SQLException: Error from org.apache.hadoop.hive.ql.exec.mr.MapRedTa ...
- hibernate的子查询
hibernate原话 HQL supports subqueries in the where clause. We can't think of many good uses for subque ...
- Docker的Gitlab镜像的使用
Gitlab是一款非常强大的开源源码管理系统.它支持基于Git的源码管理.代码评审.issue跟踪.活动管理.wiki页面,持续集成和测试等功能.基于Gitlab,用户可以自己搭建一套类似Github ...
- mysql join查询的on 与 where 的不同点
on总数以left join的左表为准,where会过滤掉,不符合where条件的数据
- Centos7安装mysql缺乏yum源怎么安装
找到mysql5.6的centos的repo源,终于解决mysql的安装问题: 1.确保centos安装了wget,没有的话安装wget 1 yum install wget 2.下载mysql的 ...
- vue 之 nodejs中npm的使用
npm是什么? 简单的说,npm就是JavaScript的包管理工具.类似Java语法中的maven,gradle,python中的pip. 安装包 我们在桌面上创建一个文件夹/01-studyNpm ...
- 短信部分之PDU简介及其格式(转)
PDU是大多数手机短信通讯的核心,仅有少数手机只支持Text模式(例如笔者的MOTO C330).PDU模式比起Text模式可以提供能为强大的功能,但其编码较Text模式困难.无论哪种模式,我们都 ...