Write a program that reads a sequence of words, creates groups of words with the same length, and prints the group with longer words. Groups of just one word are not considered.
For instance, the sequence: cat mouse dog fly crocodile bat horse
contains a group of one word with 9 letters (crocodile), a group of 2 words of length 5 (mouse,horse), and a group of four 3-letter words (cat,dog,fly,bat).
Thus, the output must be mouse horse, since it is the group (with more than one word) that contains longer words.
If no groups with more than one word are found, the program output must be "All words have different lengths".
Input The input is a sequence of words.
Output The output is the group of equal-length words which are longer than words in any other group, discarding groups of size 1.
Input
cat mouse dog fly crocodile bat horse
Output
mouse horse
Input
bat mouse crocodrile elephant geko
Output
All words have different lengths
Input
cat mouse dog fly crocodile bat horse armadillo snake
Output
crocodile armadillo