题目描述:
输入格式
输入包括一个英语句子。
输出格式
按单词的顺序把单词倒序输出
样例输入
I love you
样例输出
you love I
数据规模和约定
简单的字符串操作
资源限制
时间限制:1.0s 内存限制:256.0MB
代码块:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String sp[] = s.split(" ");
for(int i = sp.length-1; i >= 0; i--){
System.out.print(sp[i]+" ");
}
}
}
评测结果: