Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
44658 | 蒋金珂 | 单词翻转 | C++ | Accepted | 3 MS | 272 KB | 312 | 2023-02-22 17:50:05 |
#include<iostream> using namespace std; int main() { string s; getline(cin,s); int b=s.length(),d=0; for(int i=0; i<b; i++) { if(s[i]==' ') { for(int t=i-1; t>=d; t--) { cout<<s[t]; } cout<<" "; d=i+1; } } for(int t=b-1; t>=d; t--) { cout<<s[t]; } return 0; }