您的位置:首页 > 其它

hdu 1062 Text Reverse

2012-11-28 19:56 239 查看
直接读取字符串,然后倒序输出

要注意的就是中间的空白字符必须全部输出,不然会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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: