hdu 1062 Text Reverse

简介:

直接读取字符串,然后倒序输出

要注意的就是中间的空白字符必须全部输出,不然会PE。

 

/*
author:jxy
lang:C/C++
university:China,Xidian University
**If you need to reprint,please indicate the source**
*/
#include <cstdio>
#include <cstring>
char s[1001],t;
main()
{
    scanf("%*d");
    while(~scanf("%s",s))
    {
        for(int i=strlen(s)-1;i>=0;)putchar(s[i--]);
        while((t=getchar())==' '||t=='\n')putchar(t);
        ungetc(t,stdin);
    }
}


 

目录
相关文章
LeetCode 258. Add Digits
给定一个非负整数 num,反复将各个位上的数字相加,直到结果为一位数。
51 0
LeetCode 258. Add Digits
|
算法
LeetCode 68. Text Justification
给定一个单词数组和一个宽度maxWidth,格式化文本,使每行具有正确的maxWidth字符并完全(左和右)对齐。
65 0
LeetCode 68. Text Justification
LeetCode 402. Remove K Digits
给定一个以字符串表示的非负整数 num,移除这个数中的 k 位数字,使得剩下的数字最小。
54 0
LeetCode 402. Remove K Digits
HDU-1062,Text Reverse(字符串处理 and 栈)
HDU-1062,Text Reverse(字符串处理 and 栈)
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
102 0
HDOJ/HDU 1321 Reverse Text(倒序输出~)
HDOJ/HDU 1321 Reverse Text(倒序输出~)
77 0
|
Sentinel
HDOJ/HDU 1113 Word Amalgamation(字典顺序~Map)
HDOJ/HDU 1113 Word Amalgamation(字典顺序~Map)
88 0
HDOJ(HDU) 2115 I Love This Game(排序排序、、、)
HDOJ(HDU) 2115 I Love This Game(排序排序、、、)
71 0