#K40382. Character Frequency Summary

    ID: 26630 Type: Default 1000ms 256MiB

Character Frequency Summary

Character Frequency Summary

Given a list of strings, your task is to compute a summary of character occurrences for each unique string. For every string, count the number of times each character appears. Note that if the same string appears multiple times, it should be processed only once. In other words, if a string \(s\) appears more than once, its frequency dictionary should appear just once in the output.

The output should be a JSON object where each key is one of the unique input strings, and the corresponding value is another JSON object representing the \(frequency\) of each character in that string.

inputFormat

The first line contains an integer \(n\) representing the number of strings. Each of the following \(n\) lines contains a single string.

outputFormat

Output a JSON object in one line. Each key in the object is a unique string from the input, and its associated value is another JSON object containing the character counts. Characters in the inner objects should appear in the order they first appear in the string.

## sample
3
hello
world
python
{"hello": {"h": 1, "e": 1, "l": 2, "o": 1}, "world": {"w": 1, "o": 1, "r": 1, "l": 1, "d": 1}, "python": {"p": 1, "y": 1, "t": 1, "h": 1, "o": 1, "n": 1}}