Longest Potassium Compound

Write a program that reads several sequences of molecules. For each sequence, the program must print the longest molecule containing some potassium (K) atom.

Input

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.

Output

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.

Problem information

Author: Lluís Padró

Generation: 2026-01-25T16:35:22.035Z

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