Longest a-word X12727


Statement
 

pdf   zip

html

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.

Public test cases
  • Input

    6 ab alio spectes alteri quod feceris
    4 ad augusta per angusta
    0
    5 ad mores natura recurrit damnatos
    4 faber quisque fortunae suae
    
    
    
    

    Output

    alteri
    angusta
    no one
    ad
    no one
    
  • Information
    Author
    ProAl
    Language
    English
    Official solutions
    Python
    User solutions
    Python