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

提取不重复的整数

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

//还算简单,就是没看清题,需要先逆序再求
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

int main() {

    string in;
    cin>>in;
    string res(in.rbegin(), in.rend());
    unordered_map<char, int> st;
    for(auto ch:res){
        if(st.find(ch)!=st.end())
            continue;
        st[ch]++;
        cout << ch;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务