Longest a-word

Write a program that provided a sequence of words prints the longest
word in the sequence that starts with a.

Input

The input has one or more cases. Each case starts with a non negative
integer n followed by a sequence of n words consisting of lowercase
letters.

Output

For each case, the program has to print in a line the longest word
starting with a. In case of a tie, it will write the lowest in the
alphabetical order —the order defined by the standard inequality
comparison on strings—. If there is no word starting with ’a’, the
program has to write no one.

Problem information

Author: ProAl

Generation: 2026-01-25T13:38:05.706Z

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