简单题,善用API

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] str = sc.nextLine().split(" ");
        for(int i = str.length - 1; i >= 0; i--){
            System.out.print(str[i]);
            if(i != 0)
                System.out.print(" ");
        }
    }
}