Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158661 章泽原 字符串反转 C++ Presentation Error 5 MS 268 KB 594 2026-08-22 16:24:20

Tests(0/1):


Code:

#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; }