提交时间:2019-12-21 15:17:39

运行 ID: 3725

#include <iostream> using namespace std; int i; #include <stdio.h> #include <cstring> #define A 1000+5 int main() { char ch[A]; int position1=0,position2; gets(ch); int len=strlen(ch); ch[len]=' '; for(i=0;i<=len;i++) { if(ch[i]==' ') { position2=i; for(int j=position2-1;j>=position1;j--) { cout<<ch[j]; } cout<<" "; position1=position2+1; } } cout<<endl; return 0; }