#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s;
getline(cin,s);
int len=s.size();
for(int i=len-1;i>=0;i--)
{
if(s[i]==‘ ‘)
{
string s1;
char *p=&s[i];
s1.assign(p+1,s.end());
cout<<s1<<" ";
s.erase(p,s.end());
}
}
cout<<s<<endl;
return 0;
}
时间: 2024-11-06 05:30:43