First line with a frequent letter X51664


Statement
 

pdf   zip

html

Write a program that finds the first line in which some lowercase letter appears often enough.

Input

The first line of the input contains a nonnegative integer n. Then comes a text of unpredictable length, formed by letters, numbers, spaces, and punctuation symbols, presented in zero or more lines of unpredictable lengths and finished by a line that contains only the single word "END" in uppercase (plus, possibly, arbitrary whitespace).

Output

The output must be the first line of the text in which some lowercase letter appears at least n times, followed by another line reporting "In that line, letter ... appears ... times.", with appropriate values in the placeholder ellipses; if several lowercase letters are frequent enough, the first one in alphabetical order is to be reported. In case no line contains such a frequent letter, the output must be the line "No line contains a letter appearing ... times." Pay attention to the finishing period in the output lines.

Public test cases
  • Input

    7
    Not marble nor the gilded monuments
    Of princes shall outlive this powerful rhyme,
    But you shall shine more bright in these contents
    Than unswept stone besmeared with sluttish time.
    When wasteful war shall statues overturn,
    And broils root out the work of masonry,
    Nor Mars his sword nor war's quick fire shall burn
    The living record of your memory.
    END

    Output

    And broils root out the work of masonry,
    In that line, letter o appears 7 times.
    
  • Input

    3
    YES, THEY SAY...
    that the number of the beast is 666.
       END   

    Output

    that the number of the beast is 666.
    In that line, letter e appears 4 times.
    
  • Input

    7
    When, in disgrace with fortune and men's eyes,
    I all alone beweep my outcast state,
    And trouble deaf heaven with my bootless cries,
    END

    Output

    No line contains a letter appearing 7 times.
    
  • Information
    Author
    José Luis Balcázar
    Language
    English
    Official solutions
    Python
    User solutions
    Python