Problem : (1.2.1) Text Reverse
#include<iostream>
using namespace std;
void main()
{
char arr[1000];
int a,n;
int s,t;
cin>>a;
getchar();
for(int i=0;i<a;i++)
{
gets(arr);
n=strlen(arr);
s=0;
for(int j=0;j<=n;j++)
{
if(arr[j]==' '||arr[j]=='\0')
{
t=j;
for(int l=t-1;l>=s;l--)
{
cout<<arr[l];
}
s=t+1;
if(s!=n+1)
cout<<" ";
} }
cout<<endl;
}
}
|
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 |
|
Sample Output
hello world! |
Problem : (1.2.1) Text Reverse的更多相关文章
- HDOJ 1062 Text Reverse
Text Reverse Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- hdu 1062 Text Reverse 字符串
Text Reverse Time L ...
- Text Reverse
Text Reverse Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- (reverse) Text Reverse hdu1062
Text Reverse Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- 简单字符串处理 hdu1062 Text Reverse
虽然这个题目一遍AC,但是心里还是忍不住骂了句shit! 花了一个小时,这个题目已经水到一定程度了,但是我却在反转这个操作上含糊不清,并且还是在采用了辅助数组的情况下,关系的理顺都如此之难. 其实我是 ...
- HDOJ/HDU 1062 Text Reverse(字符串翻转~)
Problem Description Ignatius likes to write words in reverse way. Given a single line of text which ...
- HDU1062:Text Reverse
Problem Description Ignatius likes to write words in reverse way. Given a single line of text which ...
- 杭电acm刷题(3):1062,Text Reverse 标签: 杭电acm 2017-05-15 08:26 126人阅读 评论(0)
Problem Description Ignatius likes to write words in reverse way. Given a single line of text which ...
- 题解报告:hdu 1062 Text Reverse
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 Problem Description Ignatius likes to write word ...
随机推荐
- Activiti获取ProcessEngine的三种方法
1.通过ProcessEngineConfiguration获取 package cn.lonecloud.mavenActivi; import org.activiti.engine.Proces ...
- Java——正则表达式
题目: java中提供了对正则表达式的支持. 有的时候,恰当地使用正则,可以让我们的工作事半功倍! 如下代码用来检验一个四则运算式中数据项的数目,请填写划线部分缺少的代码. 注意:只填写缺少代码,不要 ...
- ZOJ - 3261 逆向并查集
思路:很巧妙的解法.如果按照常规一边读入,一边合并并查集,删边实在没办法做. 首先读入所有的操作,把所有不会被删除的边加入并查集,然后从最后一个操作开始逆向操作,当遇到删边操作,就直接把这条边加入并查 ...
- redis 突然大量逐出导致读写请求block
现象 redis作为缓存场景使用,内存耗尽时,突然出现大量的逐出,在这个逐出的过程中阻塞正常的读写请求,导致 redis 短时间不可用: 背景 redis 中的LRU是如何实现的? 当mem_used ...
- ul+jquery自定义下拉选择框
<!doctype html> <html> <head> <meta charset="UTF-8"> <title> ...
- python︱字符操作杂记(split、zip...)
字符串特别是中文在python里面还是有很多需要注意的地方. . . . 一.字符串 . . 1.字符串连接 方式一:单个字符相连用 + 就可以: 方式二:list组内相连,可以用join: 方式三: ...
- vxworks下文件读写示例
dev 1.create file on floopy disk and write contents: -> pdev=fdDevCreate(0,0,0,0) /* A:,1.44M ...
- 获取Filter的三种途径
一.通过CLSID [cpp] view plaincopyprint? IBaseFilter *pF = 0; HRESULT hr = CoCreateInstance(clsid, 0, CL ...
- TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9a7c0a1 转换为 spark.core.IViewport。
1.错误描述 TypeError: Error #1034: 强制转换类型失败:无法将 mx.controls::DataGrid@9aa90a1 转换为 spark.core.IViewport. ...
- Java web切面编程
在我们的 web开发中 我们在 对公用的 一些方法 我们需要抽取出来 这样达到 代码的冗余 今天 我利用项目上用的AOP的 实际 应用做了一个整理 首先 xml配置 扫描 <?xm ...