Implement getAllWordsWithRank