Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
69571 | 李琥博 | 单词翻转 | C++ | Accepted | 1 MS | 276 KB | 417 | 2024-04-05 17:49:54 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); s+=" "; int n=s.length(),a=0; for(int i=0;i<n;i++){ if(s[i]==' '){ for(int j=i-1;j>=a;j--){ cout<<s[j]; } cout<<" "; a=i+1; } } return 0; }