Run ID:118279

提交时间:2025-04-26 16:39:54

#include <bits/stdc++.h> using namespace std; char s[1005]; int main() { gets(s); //reverse(s, s + strlen(s)); s[strlen(s)] = ' '; int l = 0; for(int i = 0; i < strlen(s); ++i) { if(s[i] == ' '){ reverse(s + l, s + i); l = i + 1; } } cout << s << endl; return 0; }