Need help with set implementation

Suppose, I wanna insert my name characterwise into a set so that it doesn’t contain any duplicate character.
My code is given below:
using namespace std;
int main(){
int i;
string s;
for(i=0; i<s.length(); i++);
return 0;

What can i do next anyone please help me by doing this.

Your Question Is Not Clear!

I have extracted each character of my name (T a s p i y a this way). I want to insert each character in a set so that there are no duplicate characters in the set. So how can I do that?

Should I Give You Code Or Just Explain It??

You can give me the code.

There Are 2 a Do You Want Only One?? T a s p i y a

Fine I Am Giving

There Are 2 a Do You Want Only One?? T a s p i y a

You can give both.


As You Said Both a

public class SET_SPLIT {
    public static void main(String[] args) {
        String str = "T a s p i y a";
        String[] splited = str.split("\\s+");
        for(int i = 0; i < splited.length; i++){

Its In Java Though :smiley:

Yeah okay. Thanks a lot for your favor. Now, I try to implement it using C++.

Please Format Your Code So That Its Easy To Read

If You Want In C++ I Will Give You But Some Time Later

Yeah okay. When you’ll have time then give me in C++.

Fine :slight_smile:

1 Like