如果是同一个单词出现多次,也不符合要求!!!!
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
Set<String> set=new TreeSet<>();
Map<String,Integer> map=new HashMap<>();
Map<String,String> origin=new HashMap<>();
while(true) {
String[] s=sc.nextLine().split(" ");
if(s[0].equals("#"))break;
for (int i = 0; i < s.length; i++) {
String cur=s[i];
char[] c=s[i].toUpperCase().toCharArray();
String s1="";
Arrays.sort(c);
for (int j = 0; j < c.length; j++) {
s1+=c[j];
}
if(!map.containsKey(s1)) {
map.put(s1, 1);
origin.put(s1, cur);
}else {
map.put(s1, map.get(s1)+1);
}
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if(entry.getValue()==1) {
set.add(origin.get(entry.getKey()));
}
}
for (String s : set) {
System.out.println(s);
}
}
}