题解 | #句子逆序#
句子逆序
http://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
LinkedList<String> stk = new LinkedList<>();
while (scanner.hasNext()) {
stk.addLast(scanner.next());
}
while (!stk.isEmpty()) {
System.out.print(stk.removeLast() + " ");
}
}
}