What is the equivalent of Python set(string) in C++

1 Answer

0 votes
#include <iostream>
#include <string>
#include <set>

int main()
{
    std::string str = "C++ Programing";

    std::set<char> st(str.begin(), str.end());

    for (char ch : st) {
        std::cout << ch << " ";
    }
}


 
/*
run:
 
+ C P a g i m n o r 
 
*/

 



answered Feb 7, 2024 by avibootz

Related questions

1 answer 118 views
1 answer 101 views
1 answer 147 views
1 answer 197 views
1 answer 161 views
1 answer 148 views
1 answer 141 views
...