Competitions

# Maximum Word Frequency

Term frequency–Inverse document frequency (tf-idf) is a numerical statistic which reflects the importance of words in a document collection. It is often used in information retrieval system. The number of times a word appears in the document (word frequency) is one of the major factors to acquire tf-idf.

You are asked to write a program to find the most frequent word in a document.

#### Input

The first line contains an integer n (1n1000) which determines the number of words. The following n lines include the list of words, one word per line. A word contains only lower-case letters and it can contain up to 20 characters.

#### Output

Print the word that has the highest frequency and its frequency, separated by a single space. If you get two or more results, choose one that comes later in the lexicographical order.

Time limit 1 second
Memory limit 128 MiB
Input example #1
10
mountain
lake
lake
zebra
tree
lake
zebra
zebra
animal
lakes

Output example #1
zebra 3

Source 2013 ACM Asia Phuket Regional Programming Contest 2013, Practice Session, November 21