Write a program that reads several sequences of molecules. For each sequence, the program must print the longest molecule containing some potassium (K) atom.
The input consists of several sequences of molecules. Each sequence
is provided as a number n, followed by n
molecules.
No molecules containing Krypon (Kr) will appear in the sequences.
The output is the molecule containing potassium in each
sequence.
If there is not such a molecule in the sequence, the output is
none.
If several such molecules exist, the one with the longest name is
printed.
If several potassium molecules with the same name length are found, the
last one should be printed.
Author: Lluís Padró
Generation: 2026-01-25T16:35:22.035Z
© Jutge.org, 2006–2026.
https://jutge.org