#C14059. Character Frequency
Character Frequency
Character Frequency
You are given a string consisting solely of lowercase English letters. Your task is to count the frequency of each character in the string and output the result as a JSON object. The output must be a JSON object with keys sorted in lexicographical order. If the string is empty, output an empty object {}.
Example:
Input: aabbcc Output: {"a": 2, "b": 2, "c": 2}
Note: The keys in the JSON object must be in sorted order (i.e. increasing lexicographical order).
You may use the formula for the frequency counting as follows:
\( freq(c) = \text{number of times character } c \text{ appears in the string}\)
inputFormat
The input consists of a single line containing a string \( s \) of lowercase English letters. The string may be empty.
outputFormat
Print a JSON object (dictionary) representing the frequency count of each character in the string. The keys of the JSON object must be sorted in lexicographical order. If \( s \) is empty, output {}.
## sampleaabbcc
{"a": 2, "b": 2, "c": 2}