题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import java.io.InputStream;
import java.util.ArrayList;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String s = String.valueOf(num);
List tr = new ArrayList();
for(int i=s.length()-1;i>-1;i--){
if(!tr.contains(s.charAt(i))){
tr.add(s.charAt(i));
}
}
Iterator ite = tr.iterator();
StringBuilder sb = new StringBuilder();
while(ite.hasNext()){
sb.append(ite.next());
}
System.out.print(sb);
}
}
#提取不重复的整数#