hdu 1062 Text Reverse
来源:互联网 发布:海口网络推广公司 编辑:程序博客网 时间:2024/06/13 09:25
Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains a single line with several words. There will be at most 1000 characters in a line.
Output
For each test case, you should output the text which is processed.
Sample Input
3
olleh !dlrow
m’I morf .udh
I ekil .mca
Sample Output
hello world!
I’m from hdu.
I like acm.
题解:
使用STL的string模拟即可,注意reverse函数的用法
代码:
#include <iostream>#include <string>#include <algorithm>#include <cstring>#include <cstdio>using namespace std;int main(){ int n; cin>>n; string tmp; string buff; getchar(); while(n--) { getline(cin,tmp); buff=""; int siz = tmp.size(); //cout<<siz<<endl; for(int i=0;i<siz;i++) { if(tmp[i]!=' ') buff+=tmp[i]; else{ reverse(buff.begin(),buff.end()); cout<<buff<<" ";buff=""; } } reverse(buff.begin(),buff.end()); cout<<buff<<endl; } return 0;}
阅读全文
0 0
- hdu 1062 Text Reverse
- hdu 1062 Text Reverse
- HDU 1062 TEXT REVERSE
- Hdu 1062 - Text Reverse
- hdu 1062 Text Reverse
- HDU 1062 Text Reverse
- hdu 1062 Text Reverse
- HDU 1062 Text Reverse
- HDU 1062 - Text Reverse
- hdu 1062 Text Reverse
- hdu 1062 Text Reverse
- Text Reverse(hdu 1062)
- hdu 1062 Text Reverse
- HDU 1062 Text Reverse
- hdu 1062 text reverse
- HDU 1062 Text Reverse
- HDU 1062 Text Reverse
- hdu 1062 Text Reverse
- codeforces 788A Functions again(dp之最大子段和)【模板】
- c++11自带thread完成一个双线程交替买票程序
- CC2640R2F BLE5.0 开发环境搭建
- poll源码剖析
- python 字典
- hdu 1062 Text Reverse
- 手机端页面测试神器--Browsersync
- JAVA中double格式化控制精度小数位数,float同理
- 编译cmake 2.8.10.2报错:undefined reference to symbol 'keypad'
- webpack的基本使用(一)
- CC2640R2F BLE5.0 下载运行第一个程序(simple_peripheral)
- 责任链模式
- ±1RMQ(约束RMQ)
- 共享 load事件--addLoadEvent