hdu 2564 词组缩写
来源:互联网 发布:js 数组和对象 编辑:程序博客网 时间:2024/06/11 21:15
Problem Description
定义:一个词组中每个单词的首字母的大写组合称为该词组的缩写。
比如,C语言里常用的EOF就是end of file的缩写。
Input
输入的第一行是一个整数T,表示一共有T组测试数据;
接下来有T行,每组测试数据占一行,每行有一个词组,每个词组由一个或多个单词组成;每组的单词个数不超过10个,每个单词有一个或多个大写或小写字母组成;
单词长度不超过10,由一个或多个空格分隔这些单词。
Output
请为每组测试数据输出规定的缩写,每组输出占一行。
Sample Input
1
end of file
Sample Output
EOF
终于AC了!!!!!
代码:
#include <iostream>#include <algorithm>#include <cstring>#include <string> #include <stdio.h>using namespace std;int main(){string st;char ch[15];int n,m,i,j,k;while(scanf("%d",&n)!=EOF){ getchar();while(n--){ j=0;getline(cin,st);for(i=0;i<st.size();i++){if(st[i]==' '&&((st[i+1]>='A'&&st[i+1]<='Z')||(st[i+1]>='a'&&st[i+1]<='z'))) { if(st[i+1]>='A'&&st[i+1]<='Z') ch[j++]=st[i+1]; else ch[j++]=st[i+1]-32; } }for(i=0;i<st.size();i++) { if(st[i]!=' ') break; } if(i==0) { if(st[0]>='a'&&st[0]<='z') st[0]=st[0]-32; cout<<st[0]; } for(i=0;i<j;i++) cout<<ch[i]; cout<<endl;}}return 0;}
0 0
- hdu 2564 词组缩写
- HDU-2564-词组缩写
- 词组缩写 2564HDU
- hdu 2564 词组缩写
- HDU 2564 词组缩写
- HDU 2564 词组缩写
- 词组缩写 HDU-2564
- HDOJ/HDU 2564 词组缩写(单词缩写)
- HDU—— 2564 词组缩写
- HDU 2564 词组缩写 标准大水题
- HDU 2464 词组缩写
- 词组缩写 2564
- hd 2564词组缩写
- 2564:词组缩写
- hdu——2564——词组缩写
- 杭电2564----词组缩写
- 词组缩写
- 词组缩写
- 分布式原理整理1
- 把一个listmap 按照要求分成两个listmap
- Objective-c利用runtime给对象添加一个变量:objc_setAssociatedObject(关联)
- HTML5 自学 (一)
- Linux Advance--文件IO--创建一个具有空洞的文件
- hdu 2564 词组缩写
- IOS GCD线程的使用
- 代码大全
- KVO
- QFiledialog添加控件
- postgresql单机版安装部署
- d森林问题
- 百度ueditor struts2图片上传问题解决方案
- Linux命令date日期时间和Unix时间戳互转