Two Frequent Words Test X22065


Statement
 

pdf   zip

thehtml

Write a program that reads a goal integer and a sequence of words and tests whether there are two different words in the sequence that appear at least as many times as the goal indicates.

Input

First comes a goal integer n; follows a sequence of nonempty words, all formed only by lower-case letters. Words are separated by blank spaces or line ends, or both; at least one such separator, but maybe more than one.

Output

If there are at least two words in the sequence that appear at least as many times as the goal n, the program must print a message like "There are two words that appear n or more times." (for the adequate value n, see the examples). Otherwise, it must print a message like "Less than two words appear n or more times." (again see the examples to see the adequate n).

Public test cases
  • Input

    2
    erre con erre guitarra erre con erre barril
    

    Output

    There are two words that appear 2 or more times.
    
  • Input

    3
    erre con erre guitarra erre con erre barril
    

    Output

    Less than two words appear 3 or more times.
    
  • Input

    3
    por esa puerta de elvira 
    sale muy gran cabalgada 
    cuanto del hidalgo moro 
    cuanta de la yegua baya 
    cuanta de la lanza en mano 
    cuanta de la adarga blanca
    
    

    Output

    There are two words that appear 3 or more times.
    
  • Input

    100
    the p versus np problem is a major unsolved 
    problem in computer science the underlying 
    issues were first discussed in the nineteen fifties
    

    Output

    Less than two words appear 100 or more times.
    
  • Input

    2
    the p versus np problem is a major unsolved 
    problem in computer science the underlying 
    issues were first discussed in the nineteen fifties
    

    Output

    There are two words that appear 2 or more times.
    
  • Information
    Author
    Language
    English
    Official solutions
    Python
    User solutions
    Python