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

提取不重复的整数

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

#include <iostream>
#include <string>
using namespace std;

int main() {
    
    int num;
    cin >> num;
    string str = to_string(num), out = "";
    str = string(str.rbegin(), str.rend());

    for (auto item : str) {
        if (out.find(item) == out.npos) out += item;
    }
    cout << out << endl;

}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

点赞 评论 收藏
转发
投递阿里巴巴控股集团等公司10个岗位 >
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务