小C很喜爱倒着写单词,当初给你一行小C写的文本,你能把每个单词都反转并输入它们吗?
输出
输出蕴含多组测试样例。第一行为一个整数T,代表测试样例的数量,前面跟着T个测试样例。
每个测试样例占一行,蕴含多个单词。一行最多有1000个字符。
输入
对于每一个测试样例,你应该输入转换后的文本。
样例输出 Copy
3
olleh !dlrow
I ekil .bulcmca
I evol .mca
样例输入 Copy
hello world!
I like acmclub.
I love acm.
代码示例(本人写的,只能过平台,不完满)
//#include <algorithm>
//#include <iostream>
//using namespace std;
//#include <vector>
//#include <stack>
//#include <queue>
//#include <cmath>
//#include <string>
//#include <string.h>
//
//int main() {
// int t = 0;
//// cin >> t;
//// getchar();
// scanf("%d",&t);
// getchar();//当输出之后接着要输出字符(串)变量时,须要用getchar()吃掉下面输出之后的空格
// while(t--){
// int k = 0;
// string str;
// getline(cin,str);
// for(int i = 0; i < str.size(); i++){
// if(str[i] == ' ' ){
// for(int j = i - 1; j >= k; j--){
// cout << str[j];
// }
// cout << " ";
// k = i + 1;
// }
// }
// for(int l = str.size() - 1; l >= k; l--){
// cout << str[l];
// }
// cout << endl;
// }
// return 0;
//}
发表回复