Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
150849 林嘉乐 单词翻转 C++ Accepted 1 MS 276 KB 361 2026-04-01 15:06:35

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main() { string s; getline(cin,s); int b=0,t=0; int a=s.size(); for(int i=0;i<a;i++){ if(s[i]!=' '){ b++; } if(s[i]==' '||i==a-1){ t+=b; for(int j=1;j<=b;j++){ cout<<s[t-j]; } if(i!=a-1){ cout<<s[i]; } t++; b=0; } } return 0; }