Run ID:158666

提交时间:2026-08-22 16:27:38

#include <iostream> #include <string> #include <sstream> #include <algorithm> using namespace std; int main() { int T; cin >> T; cin.ignore(); while (T--) { string line; getline(cin, line); stringstream ss(line); string word; bool first = true; while (ss >> word) { reverse(word.begin(), word.end()); if (!first) cout << " "; cout << word; first = false; } cout << endl; } return 0; }