题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);
//逆序排列
StringBuilder stringBuilder = new StringBuilder(scanner.nextLine()).reverse();
String str = stringBuilder.toString();
//结果集
StringBuilder result = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
if (str.indexOf(str.charAt(i)) == i) {
result.append(str.charAt(i));
}
}
System.out.println(result.toString());
}
}