题解 | #字符串反转#

字符串反转

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());
        }
    }
}
#华为面试##华为笔试#
全部评论

相关推荐

舂锋:不能投什么岗都用一份简历,一般都是要看企业的岗位需求来写职业技能或者是项目经历,跟岗位相关的就写多一点。
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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