#C188. String Frequency Analysis

    ID: 45133 Type: Default 1000ms 256MiB

String Frequency Analysis

String Frequency Analysis

You are given a list of strings. Your task is to calculate two quantities for each unique string:

1. The count of appearances in the list.

2. The percentage frequency with respect to the total number of strings, rounded to two decimal places. Note that if the percentage is an integer, it should be displayed with one decimal place (for example, 50.0).

For instance, given the input list ["apple", "banana", "apple", "apple", "cherry", "banana"], the expected output is:

{"apple": (3, 50.0), "banana": (2, 33.33), "cherry": (1, 16.67)}

The final output should be printed as a dictionary with keys sorted in lexicographical order.

inputFormat

The input is read from standard input (stdin). The first line contains an integer n, representing the number of strings. The next n lines each contain a single string.

outputFormat

Output to standard output (stdout) a dictionary where each key is a unique string from the input, and the value is a tuple in the format (count, percentage). The keys must be sorted in lexicographical order. For example:

{"apple": (3, 50.0), "banana": (2, 33.33), "cherry": (1, 16.67)}

## sample
6
apple
banana
apple
apple
cherry
banana
{"apple": (3, 50.0), "banana": (2, 33.33), "cherry": (1, 16.67)}