#C3871. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
You are given a string as input. Your task is to count the frequency of each character present in the string and output the result as a dictionary in JSON format. The dictionary's keys should be the characters and the corresponding values are their frequencies. For consistency, the keys in the output must be sorted in lexicographical order.
In mathematical terms, if the input string is s and the set of unique characters is C, then for each character \( c \in C \):
[ \text{frequency}(c) = |{ i \mid s_i = c }| ]
For example:
- Input:
aabb
→ Output:{"a":2,"b":2}
- Input:
abcabc
→ Output:{"a":2,"b":2,"c":2}
inputFormat
The input consists of a single line string read from standard input (stdin). The string may be empty and can contain letters, digits, spaces, or special characters. Trailing newlines should be ignored.
outputFormat
The output is a dictionary in JSON format printed to standard output (stdout), where each key is a character from the input string and its value is the number of times that character appears. The keys must be printed in lexicographical order.
## sample
{}