remove duplicate string in a string array

can anyone tell me or give me a code?
How to remove duplicate strings in a given string array without using two loops
or less complexity.

Hello cc046,

In the Reference section here go to http://www.cplusplus.com/reference/string/string/

There yo will find many useful member functions of the string class. "stringName.erase()" comes to mind, but that is not the only function that you are likely to need.

Without an example of what you are working with there could be other ways of doing what you need.

Hope that helps,

Andy
Use a std::set<string>. sets don't store duplicates.
You can't delete an element from an array since arrays don't change their size. You can only set a string to "" if it is a duplicate. Sort the array first and then you need only one loop.
Thanks
@Handy Andy
@lastchance
@Thomas1965

I didn't want to delete common characters in a string.
I want to delete common string in a string array.

Example INPUT-
N=5
string1
string2
string3
string1
string2

OUTPUT-
string1
string2
string3
Nobody is asking you to delete anything. Insert your strings into a set<string> and then output the contents of that set. Like I said, sets don't maintain duplicates.
http://www.cplusplus.com/reference/set/set/
Topic archived. No new replies allowed.