Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
4311 | 孙灏洋 | 字符串反转 | C++ | Accepted | 100 | 3 MS | 252 KB | 350 | 2020-01-03 20:40:29 |
#include<iostream> using namespace std; int main(){ int n; char str[1001]; scanf("%d%*c",&n); for(int k=1;k<=n;k++){ gets(str); int i=0; while(str[i]){ while(str[i]==' ') printf("%c",str[i++]); int l=i; while(str[i]&&str[i]!=' ') i++; int r=i-1; while(l<=r) printf("%c",str[r--]); } cout<<endl; } }