/CSSSR

Test task for CSSSR

Primary LanguageJava

Test task for CSSSR.

There is a line consisting of words. All words in it are separated by a single space. You need to convert the string to a data structure that groups words by the first letter in the word. Then print only groups containing more than one element.

Groups must be sorted alphabetically. Words within a group must be sorted in descending order of characters; if the number of characters is equal, then sort in alphabetical order.

Example string: String s = "сапог сарай арбуз болт бокс биржа"

Sorted string: [б=[биржа, бокс, болт], c=[caпог, сарай]]