/* TreeSet<T>a=new TreeSet<T>();*/= ̄ω ̄=
Scanner sc = new Scanner(System.in);= ̄ω ̄=
System.out.println("shuruzifuchan");= ̄ω ̄=
String s = sc.nextLine();= ̄ω ̄=
// 定义集合存储字符 -- 有序无重复LinkedHashSet= ̄ω ̄=
LinkedHashSet<Character> q = new LinkedHashSet<>();= ̄ω ̄=
for (int i = 0; i < s.length(); i++) {= ̄ω ̄=
q.add(s.charAt(i));= ̄ω ̄=
}= ̄ω ̄=
// 遍历集合组成新的字符串= ̄ω ̄=
StringBuilder aa = new StringBuilder();= ̄ω ̄=
for (Character ss : q) {= ̄ω ̄=
aa.append(ss);= ̄ω ̄=
}= ̄ω ̄=
// 转为结果字符串= ̄ω ̄=
String h = aa.toString();= ̄ω ̄=
System.out.println("其中的无重复字符为:" + h);= ̄ω ̄=
}= ̄ω ̄=
黑猫想成为创造者= ̄ω ̄=
最新推荐文章于 2024-04-24 22:31:16 发布