题解 | 提取不重复的整数

提取不重复的整数

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

#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <map>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>//队列
#include <stack> //栈
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
#define pii pair<int, int>
//queue<int> que;
//set<int> s;
//stack<int> st;



void solve() {
    //scanf("%d", &);
    //printf("\n", );

    /*
    cout << "手慢无" << endl;
    cout << "骗你的,手快也无" << endl;
    cout << "haha ^_^" << endl;
    */

    //vector<int>a(n);
    //sort(a.begin(), a.end());
    //map<int, int>mp;

    string s;
    cin>>s;

    reverse(s.begin(),s.end());//倒序
    map<char,int>mp;//记录出现次数
    //cout<<s;
    for(int i=0;i<s.size();i++)
    {
        if(mp[s[i]]==0)
        {
            cout<<s[i];
            mp[s[i]]++;
        }
    }

}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
        cout << endl;
    }
    return 0;
}

#牛客春招刷题训练营#
全部评论

相关推荐

09-28 09:18
吉首大学 Java
离上岸不远了的牛油很...:同27,你写的专业技能那些是真熟练了吗,我感觉稍微问深一点我都要🐔
你找实习最大的坎坷是什么
点赞 评论 收藏
分享
09-17 19:25
已编辑
太原理工大学 游戏测试
叁六玖:公司名发我,我要这个HR带我打瓦
我的秋招日记
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务