#C13693. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
Given a string, count the frequency of each alphabetic character (ignoring case) and output the result as a dictionary (or map) in which the keys are lowercase letters and the values are their corresponding counts. Only alphabetic characters should be considered. For example, for the input string "Hello World! This is a Test.", the frequencies (sorted in ascending order by character) are given by:
$$\{\mathtt{'a'}:1, \mathtt{'d'}:1, \mathtt{'e'}:2, \mathtt{'h'}:2, \mathtt{'i'}:2, \mathtt{'l'}:3, \mathtt{'o'}:2, \mathtt{'r'}:1, \mathtt{'s'}:3, \mathtt{'t'}:3, \mathtt{'w'}:1\}$$
The program should read the input string from standard input and output the frequency dictionary in JSON format with keys sorted in ascending lexicographical order, and no extra spaces (i.e. use a compact representation).
inputFormat
The input is a single string (which may include spaces and punctuation) provided via stdin.
outputFormat
The output should be a JSON dictionary (or map) where each key is a lowercase alphabet character and the corresponding value is the number of times that character occurs in the string. The keys should be sorted in ascending order. The output is written to stdout.
## sampleHello World! This is a Test.
{"a":1,"d":1,"e":2,"h":2,"i":2,"l":3,"o":2,"r":1,"s":3,"t":3,"w":1}