Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
99089 | 刘轻松 | 单词翻转 | C++ | Wrong Answer | 1 MS | 276 KB | 319 | 2024-11-24 12:08:24 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); int k,cnt=0; for(int i=0;i<=s.size();i++){ if(s[i]!=' '){ cnt++; } if(s[i]==' ' || i==s.size()){ k = i; for(int j=1;j<=cnt;j++){ cout<<s[k-j]; } cout<<' '; cnt=0; } } return 0; }
------Input------
12345
------Answer-----
54321
------Your output-----
54321