264. Byte Frequency Count

I'm a slow walker, but I never walk backwards.

Task Description

Write a program to read data from a file. Your program will open a file with binary read mode. (The file name is given in standard input.) The first four bytes of the file is a positive integer $n$, which is the number of data afterward. Then there are $n$ two byte signed integers ranging from -32768 to 32767 in binary format. Now you need to determine which number from -32768 to 32767 appears most. If there is a tie, report the largest one. For example, if both 1 and 10 appear 100 times, which is the maximum number of times, then you should report 10.

寫程式以二進制讀入一份檔案,檔案的前 4 個位元組為一個 32-bit 整數 $n$,表示接下來需要統計 16-bit 有號整數分別出現多少次。請輸出出現最多次的那個數,如果出現次數相同時,以最大的那一個為準。

Input

There is a string with maximum length 200, specifying the file name. This string can be read by scanf("%s",...).

請根據標準輸入串流中 (也就是鍵盤輸入) 的第一行字串,作為開檔的檔案名稱,你可以假設不會有特殊的空白表達式,只接使用 scanf("%s",...) 即可。

Output

You should output two lines. First line is the number that appears most, and the second line is the frequency of this number.

輸出兩行,第一行為哪個數字出現最多次,第二行為出現最多次的次數。

Sample Input

0.dat

Sample Output

10
100

Hint

參考 0.data 下載 here

Discussion