题解 | #句子逆序# 最近频繁使用stream流

句子逆序

https://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3

import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        scanner.useDelimiter("\n");
        String ss = null;

        while (scanner.hasNext()) {
            ss = scanner.next();
            String[] s = ss.split(" ");
            Arrays.stream(s).sorted((o1, o2) -> -1).forEach((j)-> System.out.print(j + " "));
        }
    }
}

全部评论

相关推荐

牛客464620405号:随便投,随便找,中国经过40多年的改革开放,人才缺口和职位空缺是巨大的,中国现在属于遍地黄金的年代,属于90后和00大机遇的时代
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务