#K33277. Character Occurrence Counter
Character Occurrence Counter
Character Occurrence Counter
Given an input string, count the number of occurrences of each unique character in a case-insensitive manner. The result should be output as a JSON object, where each key is a character (in lowercase) and its value is the number of times it appears in the string.
For example, if the input is hello world
, the expected output is:
{" ": 1, "d": 1, "e": 1, "h": 1, "l": 3, "o": 2, "r": 1, "w": 1}
Note that characters such as spaces and special symbols should be counted just like letters and digits.
inputFormat
The input is provided via standard input (stdin) as a single line string. The entire string should be processed.
outputFormat
Output the JSON representation (in one line) of a dictionary that maps each unique character (converted to lowercase) to its occurrence count. The keys in the JSON output should be sorted in lexicographical order.
## samplehello world
{" ": 1, "d": 1, "e": 1, "h": 1, "l": 3, "o": 2, "r": 1, "w": 1}