#C12150. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
You are given a string ( S ). Your task is to count the frequency of each alphabetical character in ( S ), ignoring case and any non-alphabetical characters. In other words, for every letter ( c ) (where ( c \in {a, b, \ldots, z} )), compute its frequency ( f(c) ) in ( S ). Only letters with a positive frequency should be included, and the keys in the output JSON object must be sorted in lexicographical order.
For example, for the input "Hello", the output should be {"e": 1, "h": 1, "l": 2, "o": 1}
.
inputFormat
The input consists of a single line containing the string ( S ).
outputFormat
Print a JSON object (dictionary) that represents the frequency count of each letter in ( S ). The keys must be the lowercase letters and should appear in lexicographical order. Use the format: {"key": value, ...}.## sample
Hello
{"e": 1, "h": 1, "l": 2, "o": 1}