a method that sorts a string by word length