sort words in an array