Run ID:44658

提交时间:2023-02-22 17:50:05

#include<iostream> using namespace std; int main() { string s; getline(cin,s); int b=s.length(),d=0; for(int i=0; i<b; i++) { if(s[i]==' ') { for(int t=i-1; t>=d; t--) { cout<<s[t]; } cout<<" "; d=i+1; } } for(int t=b-1; t>=d; t--) { cout<<s[t]; } return 0; }