题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include<iostream>
#include<set>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
set<int>se;
int s=n/10;
int y=n%10;
int res=0;
while(s)
{
if(se.count(y)==0)
{
se.insert(y);
res=res*10;
res+=y;
}
y=s%10;
s/=10;
}
if(se.count(y)==0)
{
se.insert(y);
res=res*10;
res+=y;
}
cout<<res<<endl;
}
return 0;
}