Run ID:92849

提交时间:2024-10-06 15:23:59

#include<iostream> #include<cstring> using namespace std; int main(){ string s; int a=0,j; getline(cin,s); for(int i=0;i<s.size();i++){ if(s[i]!=' '){ a++; } if(s[i]==' '){ j = i-1; while(a>0){ cout<<s[j]; j--; a--; } cout<<' '; } if(i==s.size()-1){ j=i; while(a>0){ cout<<s[j]; j--; a--; } } } return 0; }