#C14288. Case-Insensitive String Frequency Counter

    ID: 43920 Type: Default 1000ms 256MiB

Case-Insensitive String Frequency Counter

Case-Insensitive String Frequency Counter

Given a list of strings, your task is to count the frequency of each unique string in a case-insensitive manner. In other words, the string 'Hello' is considered the same as 'hello' and 'HELLO'.

Your program should read input from standard input (stdin) and output the result to standard output (stdout) in JSON dictionary format. The keys in the output dictionary must be in lexicographical order.

Note: Convert each string to lower case before counting. This can be mathematically represented as:

slower=lower(s)s_{lower} = \text{lower}(s)

where ( s ) is an input string and ( \text{lower}(s) ) is its lowercase form.

inputFormat

The input starts with an integer N (N ≥ 0) on the first line, representing the number of strings. Then N lines follow, each containing one string.

outputFormat

Output a JSON dictionary (object) that maps each unique string (converted to lowercase) to its frequency. The keys must be sorted in lexicographical order. If there are no strings, output {}.## sample

0
{}