题解 | 多组_带空格的字符串_T组形式
多组_带空格的字符串_T组形式
https://www.nowcoder.com/practice/cff28a28d7f54419a640a8bb19f4275f
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
cin.ignore(); // 跳过换行
string s;
getline(cin, s); // 读整行
string result;
for (char c : s) {
if (c != ' ') {
result += c;
}
}
reverse(result.begin(), result.end());
cout << result << '\n';
}
return 0;
}
// 64 位输出请用 printf("%lld")

