Scanner sc = new Scanner(System.in);
System.out.println("请输入一个字符串:");
HashSet<Character> hs = new HashSet<>();
String line = sc.nextLine();
char[] c = line.toCharArray();
for (char d : c) {
hs.add(d);
}
for (Character ch : hs) {
System.out.print(ch+" ");
}
}