Run ID:110040

提交时间:2025-02-14 11:29:35

#include<bits/stdc++.h> using namespace std; int main(){ string a; int k; getline(cin,a); int len=a.length(); for(int i=0;i<len;i++){ if(a[i]!=' '){ k++; }else{ for(int j=1;j<=k;j++){ cout<<a[i-j]; } k=0; cout<<" "; } if(i==len-1){ for(int j=0;j<=k;j++){ cout<<a[i-j]; } } if(a[len-1]==' '){ cout<<" "; } } return 0; }