题目链接:提取不重复的整数_牛客题霸_牛客网
注意点:
1.整数转换为字符串处理
2.利用map中的key值唯一性
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
string str;
cin >> str;
map<char,int> m;
for (int i = str.length() - 1; i >= 0 ; --i)
{
//如果字符已出现过,continue
if (m.find(str[i])!=m.end()) continue;
else
{
cout<<str[i];
m[str[i]] = 1;
}
}
return 0;
}