(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 ...
随机推荐
- 快速排序 O(nlogn)
#include<bits/stdc++.h> using namespace std; int a[200],n; void q_sort(int l,int r){ if(l>r ...
- Fortify Scan - Static Code Analyzer
https://software.microfocus.com/en-us/products/application-security-testing/overview https://softwar ...
- 在WIN10打造成能运行Oracle的JDK的Linux
1.开发WindowsFeature(程序)里的Linux扩展接口(其实从Windows2008发布前试用时,就发现悄悄藏着一个Unix接口选项). 2.在windows应用商店可以下载到Ubuntu ...
- 同步或者重构Activiti Identify用户数据的多种方案比较
http://www.kafeitu.me/activiti/2012/04/23/synchronize-or-redesign-user-and-role-for-activiti.html 如何 ...
- Java-System.getProperty()
Java平台使用了一个Poperties对象来维护其自己的配置信息.System泪中包含有一个Properties对象用于描述当前工作环境的配置.系统properties包含了关于当前用户.当前Jav ...
- Axios插件和loading的实现
axios插件就是一个ajax插件 axios具有ajax的所有方法如 get post delete put等等的方法 使用时只需要引入即可 如import Axios form 'axios' 不 ...
- VS Code 的常用快捷键和插件
VS Code 的常用快捷键和插件 一.vs code 的常用快捷键 1.注释: a) 单行注释:[ctrl+k,ctrl+c] 或 ctrl+/ b) 取消单行注释:[ctrl+k,ctrl+u] ...
- CSS 范围选择器(自编)
选择第一个到第六个li元素ul li:nth-child(n+3):not(:nth-child(n+6)){} 选择第二个到最后一个ul li:nth-child(2)~li{} 选择除了第一个和最 ...
- python学习笔记六——堆栈和队列
4.2.3 列表的查找.排序.反转 list列表可以进行添加.删除操作,此外List列表还提供了查找元素的方法.list列表的查找提供了两种方式,一种是使用index方法返回元素在列表中的位置,另一种 ...
- js輸出
js訪問html的某個元素,使用document.getElementByID(); document.write()僅僅向文檔輸出內容,如果在頁面已經加載后輸出,原來頁面的內容會被覆蓋. docum ...