eolymp
bolt
Try our new interface for solving problems
Problems

Length and frequency of sentences

Length and frequency of sentences

In machine translation (MT) system, the length of sentences affects the performance of a MT system. The analysis of the length of sentences is one of factors to assess the difficulty of translation.

Ar-Ku+ Translation Company asks the contestants to analyze the set of sentences in English news. The information that needs to be extracted from the news is the length of the sentences and the frequency of each length. Words in a sentence are separated by a space (or spaces). We can assume that there are no other white spaces such as tab.

Input

The first line contains an integer n (1n4000) indicating the number of sentences. The following n lines are sentences, one sentence in each line. A sentence has between 2 to 75 words inclusive.

Output

Print out, in each line, the length of sentences that occurs in the input text and its frequency. The output must be sorted by the first value.

Time limit 1 second
Memory limit 128 MiB
Input example #1
7
This is an example.
Do you really understand this problem?
Yes, I really do.
This sentence has 5 words.
It's not difficult, isn't it?
X Y Z @ # % &  *  ! (    ) <*-*> 
The end.
Output example #1
2 1
4 2
5 2
6 1
12 1
Source 2011 ACM Thailand Southern Region Programming Contest, Problem D