题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream>
#include <unordered_set>
int main(int argc, char* argv[]){
int num;
std::cin >> num;
int res;
std::unordered_set<int> occured;
while(num != 0){
int cur = num % 10;
if(!occured.count(cur)){
occured.insert(cur);
res = res * 10 + cur;
}
num /= 10;
}
std::cout << res << std::endl;
return 0;
}