题解 | #HJ009 提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import java.util.*;
/**
* HJ9 提取不重复的整数 2752771 1725
*/
public class HJ009 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
List<Character> list = new ArrayList<>();
StringBuffer str = new StringBuffer(sc.nextLine());
str = str.reverse();
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (!list.contains(c)) {
list.add(c);
}
}
StringBuffer str2 = new StringBuffer();
for (Character c : list) {
str2.append(c);
}
System.out.println(str2);
sc.close();
}
}