Given a standard English sentence passed as a string, write a method that will return that sentence but with the words sorted by first letter.
All words that begin with a lower case letter should be at the beginning of the sorted sentence, and sorted in ascending order. All words that begin with an upper case letter should come after that, and should be sorted in descending order.
If a word appears multiple times in the sentence, it should be returned multiple times. Any punctuation can be discarded.
"Land of the Old Thirteen! Massachusetts land! land of Vermont and Connecticut!"
"and land land of of the Vermont Thirteen Old Massachusetts Land Connecticut"
Lower case letters are sorted a -> l -> l -> o -> o -> t
Upper case letters are sorted V -> T -> O -> M -> L -> C.
sort("take up the task eternal, and the burden and the lesson")
sort("Pioneers, O Pioneers!")
Want to propose a challenge idea for a future post? Email email@example.com with your suggestions!