void unique( BinPred pr );
The function unique() removes all duplicate elements from the list. Equality is tested using the == operator, unless pr is specified as a replacement. The ordering of the elements in a list should not change after a call to unique().
unique() runs in linear time.
E.g: JOJ 2274
Write a program that reads a single line of input, not greater than 10000 characters long, consisting of a number of lower case words separated by spaces, the number of letters of a word no more than 100, and print the words, one per line, in alphabetical order. Print each word only once regardless of how many times it appears in the input.
how green is my
using namespace std;
void Print(string& s)
int main(int argc, char** argv)
slist.unique();//The order of sort() and unique() can NOT be changed!
Leave a Comment