hdu 1062
来源:互联网 发布:有什么交友软件 编辑:程序博客网 时间:2024/06/05 18:43
Text Reverse
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 29275 Accepted Submission(s): 11517
Problem Description
Ignatius likes to write words in reverse way. Given a single line of text which is written by Ignatius, you should reverse all the words and then output them.
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.
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
3olleh !dlrowm'I morf .udhI ekil .mca
Sample Output
hello world!I'm from hdu.I like acm.HintRemember to use getchar() to read '\n' after the interger T, then you may use gets() to read a line and process it.
Author
Ignatius.L
Recommend
We have carefully selected several similar problems for you: 1073 1039 1088 1161 1113
#include<iostream>#include<string>#include<string.h>#include<sstream>using namespace std;int main(){int num;cin>>num;getchar();while(num--){char a[1001];string s[1001];int k=0,i,j,temp=0;gets(a);for(i=0;i<=strlen(a);i++){if(a[i]==' '){for(j=i-1;j>=k;j--)cout<<a[j];cout<<" ";k=i+1;}else if(i==strlen(a)){for(j=i-1;j>=k;j--)cout<<a[j];cout<<endl;}}}}
0 0
- HDU 1062
- HDU 1062
- HDU 1062
- HDU-1062
- hdu 1062
- HDU 1062
- HDU 1062
- HDU-1062
- Hdu 1062
- 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
- hdu 1062 Text Reverse
- hdu 1062 字符串处理
- C语言函数嵌套定义问题
- 创建守护进程为什么fork两次
- android stdio部局中遇到的几个问题
- c++ const 用法
- GetSchemaTable
- hdu 1062
- java学习第四天
- 安卓自定义圆形图片
- SOJ 1021
- jxl的使用总结(java操作excel)
- 摩尔定律及其在社会生活中的影响
- MyEclipse开发中,全局编码设置为UTF-8
- Mac搭建SVN服务器
- 机器学习->监督学习->线性回归(LASSO,Ridge,SGD)