#C13902. Alphabetic Character Frequency Analysis
Alphabetic Character Frequency Analysis
Alphabetic Character Frequency Analysis
Given an input string (S), your task is to calculate the frequency of each alphabetic character appearing in (S). Only letters (both uppercase and lowercase, including Unicode characters) are considered; all other characters must be ignored. The frequency count should be case-insensitive, i.e. convert all letters to lowercase before counting. Finally, output the result as a JSON object where the keys (letters) are sorted in alphabetical order.
For example, for an input of Hello
, the output should be {"e":1,"h":1,"l":2,"o":1}
.
inputFormat
The input consists of a single line, which is the string (S). Note that (S) may include spaces, punctuation, and Unicode characters. You only need to count the alphabetical characters.
outputFormat
Output a JSON object (with no extra whitespace) representing the frequency of each alphabetic character in (S). The keys of the JSON object must be ordered in alphabetical order. For example, for input Hello
the output should be: {"e":1,"h":1,"l":2,"o":1}
.## sample
Hello
{"e":1,"h":1,"l":2,"o":1}