Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133884 石水生 字符串反转 C++ Accepted 9 MS 276 KB 363 2025-10-24 15:59:57

Tests(1/1):


Code:

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