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);
    }
}


 

目录
相关文章
HDU-1062,Text Reverse(字符串处理 and 栈)
HDU-1062,Text Reverse(字符串处理 and 栈)
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
HDOJ/HDU 1062 Text Reverse(字符串翻转~)
111 0
HDOJ/HDU 1321 Reverse Text(倒序输出~)
HDOJ/HDU 1321 Reverse Text(倒序输出~)
101 0
[LeetCode]--34. Search for a Range
Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm’s runtime complexity must be in the order of O(log n). If the target is not
1100 0
[LeetCode]--415. Add Strings
Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is &lt; 5100. Both num1 and num2 contains only
1336 0