Removing repeated words from text string