题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
int main() {
int n;
cin >> n;
string str = to_string(n);
reverse(str.begin(), str.end());
unordered_set<char> set;
string res;
for (auto c : str)
{
if (set.find(c) == set.end())
{
res += c;
set.insert(c);
}
}
cout << stoi(res) << endl;
return 0;
}
// 64 位输出请用 printf("%lld")



