题解 | #单词倒排#
单词倒排
http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNextLine()) { // Use regex expression to split the array String[] v = sc.nextLine().split("[^a-z0-9A-Z]"); // Use a loop to get all we need for(int i = v.length - 1; i >= 0; i--) { System.out.print(v[i]+ ' '); } } } }