how can I convert each and every element of string push into set in c++?

#include <iostream>
#include <set>
#include <string>

int main() {
    std::string inputString = "example"; // Replace with your string
    std::set<char> charSet;

    for (char ch : inputString) {
        charSet.insert(ch);
    }

    // Display the elements in the set
    for (char ch : charSet) {
        std::cout << ch << " ";
    }

    return 0;
}