题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import javax.sound.midi.Soundbank;
import javax.swing.*;
import java.util.HashSet;
import java.util.Scanner;
import java.math.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//System.out.println("请输入一个正浮点数数值");
int A1 = input.nextInt();
if (A1 <= 1 || A1 >= 1.0E8) {
//System.out.print("Err");
}
HashSet<Character> sites = new HashSet<Character>();
int[] A2 = new int[Integer.toString((A1)).length()];
StringBuffer Send = new StringBuffer("");
for (int i = A2.length - 1; i >=0; i--) {
char x = Integer.toString((A1)).charAt(i);
if (sites.add(x)) {
Send.append(x);
}
}
System.out.println(Send.toString());
}
}