1. 牛客求解每一位数字,然后注意添加到HashSet中,如果能添加进去,则说明是没有重复的,可以输出答案
  2. 如果无法加入成功,则说明是已经重复了,可以到下一位
  3. #牛客春招刷题训练营#https://www.nowcoder.com/discuss/730467713784487936

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            // 使用HashSet来判断是否是不重复的
            HashSet<Integer> hs = new HashSet<>();
            int n = sc.nextInt();
            while(n>0){
                int a = n%10;
                if(hs.add(a)) System.out.print(a);
                n/=10;
            }
        }
    }
}