题解 | #句子逆序#

句子逆序

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) {
       
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String str = null;
        String[] strs =null;
            try {
                if (((str=br.readLine())!=null)) {
                    strs = str.split(" ");
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

           if (strs!=null){
               for (int i = strs.length - 1; i >= 0; i--) {
                   if (i == 0) {
                       System.out.print(strs[i]);
                   } else {
                       System.out.print(strs[i] + " ");

                   }
               }
           }
        

    }
} 

全部评论

相关推荐

一天代码十万三:这个学历有中大厂实习也是0面,没办法,斩杀线是这样的
点赞 评论 收藏
分享
yubullym:双非目前 0 正式 offer,打算继续实习到 1 月准备春招了
点赞 评论 收藏
分享
面了100年面试不知...:头像换成柯南再试试
点赞 评论 收藏
分享
27双非本,最近面试被挂麻了面试官说简历内容太简单了,技术栈要单独一行,各位佬有啥建议吗
LZStarV:项目太简单了,你像用什么开发的技术栈没必要写一句话,按点写就好了;有特色的比如说WebSocket、视频流这种狠狠吹,那就好看多了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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