题解 | #反序输出#

反序输出

https://www.nowcoder.com/practice/171278d170c64d998ab342b3b40171bb

#include <bits/stdc++.h>
using namespace std;

int main(){
    string a;
    while(cin >> a){
        for(int i = a.length()-1;i>=0;i--){
            cout << a[i] ;
        }
        cout << endl;
    }
}

做这题有点浪费时间了,主要是注意length()-1

全部评论

相关推荐

10-13 16:58
门头沟学院 Java
点赞 评论 收藏
分享
给个offer灞:校友 是不是金die
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务