#C6524. Character Frequency Analyzer
Character Frequency Analyzer
Character Frequency Analyzer
Given a string, your task is to compute the frequency of each character while ignoring all spaces. The comparison is case-insensitive, so 'A' and 'a' are considered the same character.
You should output the frequency dictionary in a format similar to Python's dictionary representation. Each key (a character) must be enclosed in single quotes, and the keys should be arranged in ascending lexicographical order. If the input string is empty or contains only spaces, output an empty dictionary: {}
.
Note: All outputs must be printed to stdout.
inputFormat
The input is a single line string which may contain letters, digits, spaces, and punctuation. Read the input from stdin.
outputFormat
Output the frequency dictionary in the following format:
{'character': frequency, ...}
where the keys are sorted in ascending order and each key is enclosed in single quotes. For an empty string or a string of only spaces, output {}
.
AaBb
{'a': 2, 'b': 2}