题解 | 字符串反转

字符串反转

https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04

import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s =sc.nextLine();
        for(int i = s.length()-1;i>=0;i--){
            System.out.print(s.charAt(i));
        }
    }
}

用一个for循环将字符串倒置

全部评论

相关推荐

04-29 00:12
小米_人力资源
牛客448863700号:也得看岗位呀,我还拿下美团呢,不说了送单了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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