Suppose, I wanna insert my name characterwise into a set so that it doesn’t contain any duplicate character.
My code is given below:
#include
#include
using namespace std;
int main(){
int i;
string s;
cin>>s;
setstr;
for(i=0; i<s.length(); i++)
s.at(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
There Are 2 a
Do You Want Only One?? T a s p i y a
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++){
System.out.println(splited[i]);
}
}
}
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++.