题解 | #字符串反转#

字符串反转

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

import java.io.IOException;
import java.util.Scanner;

public class Main{
    public static void main(String []args) throws IOException{
        Scanner sc = new Scanner(System.in);
        int maxLen = 1000;
        while(sc.hasNext()){
            String line = sc.nextLine().toLowerCase();
            if (line.length() > maxLen)
                line = line.substring(0, maxLen);
            System.out.println(new StringBuilder(line).reverse());
        }
    }
}
#华为面试##华为笔试#
全部评论

相关推荐

点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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