题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); HashSet<Integer> set = new HashSet<>(); while(a != 0){ int b = a % 10; if(set.add(b)){ System.out.print(b); } a /= 10; } in.close(); } }