Write a program that reads a sequence of words, and groups them by their 3-letters suffix.
For each 3-letter suffix seen in at least two different words in the sequence, the program must output the number of different words with that suffix, followed by the list of such words in alphabetical order.
The list of suffixes must also be sorted in alphabetical order.
Note that words with less than 3 letters do not have any 3-letter suffix.
The input is a sequence of words. They may be in different lines, and have a varying number of whitespaces inbetween. All words are in lowercase. There are only letters and whitespaces in the sequence.
The output is a list of 3-letter suffixes in alphabetical order. For each suffix, the number of different of seen words with that suffix is printed, followed by the list of those words, also in alphabetical order.
Follow the format in the examples.
Author: ProAl
Generation: 2026-01-25T14:05:36.827Z
© Jutge.org, 2006–2026.
https://jutge.org