First Equal Length Words

Write a program that reads a sequence of words, and locates the first two words with the same length. Note that the second element of this pair is the first word to appear with a length that has already been seen in some previous word in the sequence.

For instance, for sequence: mouse dog crocodile bat horse the output must be dog, bat, since it is the first pair of words with the same length.

If no pair with the same length is found, the program output must be "All words have different lengths".

Input

The input is a sequence of words.

Output

The output is the first pair of words with the same length.

Problem information

Author: ProAl

Generation: 2026-01-25T18:55:41.767Z

© Jutge.org, 2006–2026.
https://jutge.org