Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3597 杨洋杰 单词翻转 C++ Wrong Answer 0 MS 264 KB 612 2024-06-15 17:37:11

Tests(1/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ string a,b; int x,y; getline(cin,a); int man=a.size(); for(int i=0;i<man;i++){ if(a[i]!=' '&&i==0) y=i; if(a[i]!=' ') x++; else{ b=a.substr(y,x); for(int j=b.size()-1;j>=0;j--){ cout<<b[j]; } cout<<" "; y=i+1; x=0; } } b=a.substr(y,x); for(int j=b.size()-1;j>=0;j--){ cout<<b[j]; } if(a[man-1]==' ') cout<<" "; return 0; }


Run Info:

------Input------
! 321 23
------Answer-----
! 123 32
------Your output-----
32 123 ! 123 32