题解 | #倒置字符串#

倒置字符串

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

import java.util.Scanner;

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

       for(int i=str.length-1;i>=0;i--){
       System.out.printf("%s ",str[i]);
    }
    }
}

全部评论

相关推荐

被子有点短:有了实习后会发现有实习也没用
投递字节跳动等公司10个岗位
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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