题解 | #去除字符串中重复的字符#

去除字符串中重复的字符

https://www.nowcoder.com/practice/ffaf8888a89a4bbab80767d18b401a26

#include <iostream>
// write your code here......
#include <set>
using namespace std;

int main() {

    char str[100] = { 0 };
    cin.getline(str, sizeof(str));

    // write your code here......
    set<char> s;
    for (int i = 0; str[i] != '\0'; i++)
    {
        s.insert(str[i]);
    }
    for (auto it = s.begin(); it != s.end(); it ++)
    {
        cout << *it;
    }

    return 0;
}

全部评论

相关推荐

昨天 11:16
湖南大学 Web前端
我看到好多人都在说0offer好焦虑,结果一看是投了百度快手字节啥的。好像大家都是只想通过校招进大厂,对小公司是不考虑的吗😂可是能进大厂的难道不是只有少部分人吗,真心发问
梦想是成为七海千秋:沉默的大多数吧,喜欢晒的都是能引起共鸣的大厂,找小厂的人,别人也不认识你这个小厂,就自己偷偷找了实际上大多数人哪有什么机会能找到大厂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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