输入一个字符串,求出该字符串包含的字符集合

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

int main() {
    std::string str;

    while(std::cin>>str) {
        std::vector<char> v_c;
        v_c.clear();
        for(const auto& p:str) {
            if(find(v_c.begin(), v_c.end(), p) == v_c.end()) {
                v_c.push_back(p);
            }
        }
        for(const auto& p:v_c) {
            std::cout<<p;
        }
        std::cout<<std::endl;
    }

    return 0;
}

  

posted @ 2019-11-27 13:58  东宫得臣  阅读(792)  评论(0编辑  收藏  举报