题解 | #提取不重复的整数#

提取不重复的整数

http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1

#include<bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    set<int> set;
  //从后往前,使用set去重,插入失败时不打印。
    for(int i = s.size()-1; i >= 0; i--){
        if(set.insert(s[i] - '0').second){
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}
全部评论
打卡一下
点赞 回复 分享
发布于 2022-10-24 13:44 陕西

相关推荐

牛客935420688号:这公司幽默得很,要了简历半天一点动静都没有,过一会就给你发个邮件让你做测试,做完又没后文了,纯溜人
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务