Easy game (2) P85280


Statement
 

pdf   zip

thehtml

Consider the following game: Given a sequence of words, count the number of appearances of each one. At the end, print the word that has appeared less times, and the word has appeared more times.

Input

Input is a non empty sequence of words.

Output

Print the word that has appeared less times, and the word that has appeared more times, together with their counters. If there is a tie, choose the lexicographically smallest word.

Public test cases
  • Input

    why
    on
    qui
    quan
    que
    que
    why
    com
    qui
    que
    qui
    why
    

    Output

    com 1
    que 3
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++