| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 156251 | 李昱龙 | 单词翻转 | C++ | Wrong Answer | 1 MS | 276 KB | 398 | 2026-06-27 15:06:57 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); int len=s.size(); int k=0; for(int i=0;i<=len-1;i++){ if(s[i]!=' '){ k++; } else if(s[i]==' '){ for(int j=1;j<=k;j++){ cout<<s[i-j]; } k=0; cout<<" "; } if(i==len-1){ for(int j=0;j<=k;j++){ cout<<s[i-j]; } } } return 0; }
------Input------
12345
------Answer-----
54321
------Your output-----
54321