单词倒排
此题还是蛮简单的
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
char a[1001],b[1001];
int main(){
gets(a);
int la=strlen(a);
for(int i=la-1;i>=0;i--){
if(a[i]==' '){
for(int j=b[0];j>0;j--) cout<<b[j];
b[0]=0;
cout<<' ';
}
else b[++b[0]]=a[i];
}
for(int j=b[0];j>0;j--) {
cout<<b[j];
}
return 0;
}
欢迎采纳,不得擅自转载!!!