add helper functions sortByLength and filterOutWordsThatContainOtherWords