使用正则表达式提取所有唯一词
/* from nowjava - 时 代 Java */ import java.util.Arrays; import java.util.Scanner; import java.util.TreeSet; public class ExtractAllUniqueWords { public static void main(String[] args) { Scanner input = new Scanner(System.in); String[] words = input.nextLine().toLowerCase().split("[\\W\\d]+"); TreeSet<String> uniqueWords = new TreeSet<>(Arrays.asList(words)); for (String word : uniqueWords) {/