(stringstream toupper 空格) 词组缩写 hdu2564
词组缩写
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 16063 Accepted Submission(s): 5143
Problem Description
定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写。
比如,C语言里常用的EOF就是end of file的缩写。
Input
输入的第一行是一个整数T,表示一共有T组测试数据;
接下来有T行,每组测试数据占一行,每行有一个词组,每个词组由一个或多个单词组成;每组的单词个数不超过10个,每个单词有一个或多个大写或小写字母组成;
单词长度不超过10,由一个或多个空格分隔这些单词。
Output
请为每组测试数据输出规定的缩写,每组输出占一行。
Sample Input
1
end of file
Sample Output
EOF
(面对有空格的字符串时的,要想去掉空格时,提取其中一个单词时,可利用stringstream)
#include <iostream>
#include<string>
#include <sstream>
#include <cctype>
using namespace std;
int main()
{
int t;
cin>>t;
getchar();
while(t--)
{
string a;
getline(cin,a);
stringstream ss(a);
string buf,b;
char c;
while(ss>>buf)
{
c=toupper(buf[]);
b=b+c;
}
cout<<b<<endl;
}
return ;
}
(stringstream toupper 空格) 词组缩写 hdu2564的更多相关文章
- HDU2564 词组缩写
2019-06-03 15:00:38 感觉有有种被坑了的感觉,这道题不难,就是一再的W,
- HDOJ/HDU 2564 词组缩写(单词缩写)
Problem Description 定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写. 比如,C语言里常用的EOF就是end of file的缩写. Input 输入的第一行是一个整数T ...
- hdu 2564 词组缩写
Problem Description 定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写. 比如,C语言里常用的EOF就是end of file的缩写. Input 输入的第一行是一个整数T ...
- 词组缩写(isalpha()的应用)
Problem Description 定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写.比如,C语言里常用的EOF就是end of file的缩写. Input 输入的第一行是一个整数 ...
- stringstream 与空格 (大家讨论一下代码结果的原因)
#include <iostream> // std::cout, std::endl #include <iomanip> // std::setw #include < ...
- stringstream用法
stringstream用法 1.头文件:#include<sstream> 2.stringstream是C++提供的串流(stream)物件,其中: clear()重置流的标志状态:s ...
- Emmet使用
emmet官方文档 [翻译]Emmet (ZenCoding) 缩写语法 <!-- ul>li.item$*5 --> <ul> <li class="i ...
- detect——point_in_polygon
/******************实现功能:判断平面任一点是否在指定多边形内********************/ #include <string> #include <v ...
- UVa第五章STL应用 习题((解题报告))具体!
例题5--9 数据库 Database UVa 1592 #include<iostream> #include<stdio.h> #include<string.h&g ...
随机推荐
- combox的基本应用
easyui-combox:控件的初始化: 可以在其中进行文字的筛选功能(过滤), 动态加载数据的方法. <!DOCTYPE html><html lang="en&quo ...
- 【个人总结】软件工程M1/M2总结
个人博客连接: http://www.cnblogs.com/lwq12061168/p/4094252.html http://www.cnblogs.com/lwq12061168/p/40284 ...
- BugPhobia团队篇章:团队管理与Github源代码管理说明
0x00:序言 To the searching tags, you may well fall in love withhttp://xueba.nlsde.buaa.edu.cn/ 再见,无忧时光 ...
- Linux实验四报告
张文俊 + 原创作品转载请注明出处+ <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.学习内容 系统 ...
- 《Linux内核分析》期终总结&《Linux及安全》期中总结
<Linux内核分析>期终总结&<Linux及安全>期中总结 [李行之 原创作品 转载请注明出处 <Linux内核分析>MOOC课程http://mooc. ...
- Failed to execute goal org.springframework.boot
报错 [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:ru ...
- Array与Object
typeof([ ])的返回值是object,因为数组叫做数组对象. Array有length属性,而Object没有length属性,所以可以根据length属性来判断数据属于数组还是对象. Arr ...
- Linux:cut命令详解
cut 文件内容查看 显示行中的指定部分,删除文件中指定字段 显示文件的内容,类似于下的type命令. 说明 该命令有两项功能,其一是用来显示文件的内容,它依次读取由参数file所指明的文件,将它们的 ...
- .gitignore & .DS_Store
.gitignore & .DS_Store https://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-file ...
- C# 事件 订阅与发布
两种方式: 一: //服务器 public class Server { //服务器发布的事件 public event Action<string> MyEvent; public vo ...