HDU 1062 Text Reverse
来源:互联网 发布:java实现文件加密 编辑:程序博客网 时间:2024/05/17 17:46
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.
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.
题目大意:
先输入一个n,表示有n组测试数据。输入为一个字符串,但是这个字符串是逆向的,你需要将更改好的字符串输出。
c++
#include <iostream>#include<cstring>#include<cstdio>using namespace std;int main(){ int a,b,c,d,e; char m[1000]; cin>>a; getchar(); while(a--) { gets(m); //gets可以读入空格 b=strlen(m); e=0; //e用来存放开始与空格后一位 while(1) { for(c=e;c<b;c++) { if(m[c]==' ') break; } for(d=c-1;d>=e;d--) //将其倒着输出 { cout<<m[d]; } if(c>=b) break; e=c+1; cout<<" "; } cout<<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
- Linux格式化命令
- JAVA中的抽象类(abstract class)
- 防止上传webshell的PHP代码
- 在循环画图中设置线形
- Spark日志清洗一般流程
- HDU 1062 Text Reverse
- Unity3D快速实现UI架构设计二
- LINQ需要select多个值时怎么办?
- CTSC2017游记
- 第18章 信号的频域分析
- 【面向对象】这些基本概念,你都了解了吗(下)
- 修改分区类型和卷标
- 算法导论 思考题 13-3(AVL树)
- JVM之内存分配与回收策略