Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
47832 舒晨扬 单词翻转 C++ Accepted 3 MS 284 KB 406 2023-05-13 14:38:31

Tests(10/10):


Code:

//include<bits/stdc++.h>erase #include<iostream> #include<string> using namespace std; int main(){ //freopen("a.in","r",stdin); //freopen("b.out","w",stdout); string n; getline(cin,n); n += ' '; int n1 = n.size(); int a = 0; for(int i = 0;i < n1;i++){ if(n[i] == ' '){ for(int j = i-1;j >= a;j--){ cout << n[j]; } cout << " "; a = i + 1; } } return 0; }