题解 | #统计字符#

字符串反转

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

不用StringBuilder,不用reverse,直接倒叙开炮

import java.util.Scanner;

/**
 * @author Fanqingle
 * Created by Administrator on 2022-05-06 03:55
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        for (int i = a.length() - 1; i >= 0; i--) {
            System.out.print(a.charAt(i));
        }
    }
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务