Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152628 Kevin 字符串反转 C++ Presentation Error 6 MS 276 KB 429 2026-04-29 19:14:36

Tests(0/1):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,z,i,j; string s; cin>>n; cin.ignore(); for(i=1;i<=n;i++){ getline(cin,s); int cnt=0; int len=s.size(); for(j=0;j<len;j++){ if(s[j]==' '){ z=j; for(int c=z-1;c>=cnt;c--){ cout<<s[c]; } cout<<s[j]; cnt=j; } } z=j; for(int c=z-1;c>=cnt;c--){ cout<<s[c]; } cout<<endl; } return 0; }