题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import java.util.LinkedHashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
LinkedHashSet<Object> linkedHashSet = new LinkedHashSet<>();
int num = scanner.nextInt();
String str = num + "";
char[] chars = str.toCharArray();
for (int i = chars.length - 1; i >= 0; i--) {
linkedHashSet.add(chars[i]);
}
for (Object obj : linkedHashSet) {
// String s = obj + "";
// int n = Integer.parseInt(s);
char ch = (char) obj;
int n = ch - 48;
System.out.print(n);
}
}
}