题解 | #字符逆序#

字符逆序

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static java.util.Arrays.*;
import static java.util.stream.Stream.*;


public class Main {
    public static void main(String[] args) throws IOException {

        testTh();
    }
    private static void testTh() throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String str;
        StringBuilder sb = new StringBuilder();
        while ((str = bf.readLine()) != null) {
            String[] s = str.split(" ");
            for (String s1 : s) {
                sb.append(s1).append(" ");
            }

            System.out.println(sb.reverse().toString().substring(1));
        }

    }


}

全部评论

相关推荐

M_bao:换个排版吧哥们,看着费劲
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务