@Ankur
In a trie u first insert the first word ..take the second word..If its
not
present in the trie u insert it else remove it from original string:
removing the word requires left shifting the entire string
Alternatively u store the elements in a trie in the initial string and
terminate it
a)
1. could split the string using a regexp (into an array) in which you
define a word -- is hi. the same as hi, and hi ?
2. then perform a unique operation on the array (some languages have
this built in) to remove duplicates
3. recombine array elements into string by joining with a space,