#C13015. Most Frequent String

    ID: 42507 Type: Default 1000ms 256MiB

Most Frequent String

Most Frequent String

You are given a list of strings and your task is to determine the frequency of each unique string. The input will be provided via standard input (stdin) where the first line contains an integer ( n ) representing the number of strings. The next ( n ) lines each contain one string. Your program should output, for each distinct string in the order of its first appearance, a line in the format: string: count. For example, if the input is:

6 apple banana apple orange banana apple

The output should be:

apple: 3 banana: 2 orange: 1

If no strings are provided (i.e. ( n=0 )), the program should output nothing.

inputFormat

The first line of input contains an integer ( n ) (( n \geq 0 )), denoting the number of strings. The following ( n ) lines each contain a single string.

outputFormat

For each unique string (in the order of its first appearance in the input), print a line in the format "string: count". If the input contains no strings (( n=0 )), print nothing.## sample

6
apple
banana
apple
orange
banana
apple
apple: 3

banana: 2 orange: 1

</p>