【一只蒟蒻的刷题历程】 【HDU 1062】 Text Reverse
发布日期:2021-05-04 19:23:53 浏览次数:20 分类:技术文章

本文共 1021 字,大约阅读时间需要 3 分钟。

B - Text Reverse

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

3olleh !dlrowm'I morf .udhI ekil .mca

Sample Output

hello world!I'm from hdu.I like acm.

Hint

Remember to use getchar() to read ‘\n’ after the interger T, then you may use gets() to read a line and process it.

代码:

这里没有用栈,使用的是reverse翻转

#include 
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;int main() { int n; string s; cin>>n; cin.get(); while(n--) { getline(cin,s); string t; for(int i=0;i
上一篇:【一只蒟蒻的刷题历程】 【HDU-1276】 士兵队列训练问题
下一篇:【HDU 4841】 圆桌问题

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2025年03月16日 17时03分21秒