String ss="";
HashSet
for (int i=0; i
}
For (String nt: hs) {
Ss +=nt;
}
Return ss. ToCharArray ();
}
How do you write the code above, translated into c + +??????? Be urgent!!!!!!
CodePudding user response:
# include & lt; Hash_set & gt;
#include
Using STD: : hash_set;
Using STD: : string;
Const char * killRepeat (string inputString)
{
Size_t strlen=inputString. Length ();
Char * result=new char strlen (+ 1);
Memset (result, 0, strlen + 1);
Hash_set & lt; Char> CharList;
For (size_t I=0; iCharList. Insert (inputString [I]);
Hash_set & lt; Char> : : iterator it=charList. The begin ();
Char * pchar=the result;
for (; it !=charList. End (); It++)
* pchar=* it pchar++;
return result;
}