#C12309. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
You are given a string. Your task is to count the frequency of each character in the string while ignoring all spaces and treating uppercase and lowercase letters as the same. The output should list each distinct character and its count on a separate line. The characters must be displayed in alphabetical order.
For example, if the input is "Hello World", after converting to lowercase and removing spaces, it becomes "helloworld". The frequency counts are: h:1, e:1, l:3, o:2, w:1, r:1, d:1
. When sorted alphabetically by character, the result is:
d 1 e 1 h 1 l 3 o 2 r 1 w 1
If the string contains no characters (or only spaces), your program should produce no output.
inputFormat
The input consists of a single line string which may contain spaces. You should read the entire input from stdin
.
outputFormat
For each distinct character (after converting all letters to lowercase and removing spaces), output a line containing the character, a space, and its frequency count. The characters must be printed in alphabetical order. If there are no characters to output, print nothing.
## sampleHello World
d 1
e 1
h 1
l 3
o 2
r 1
w 1
</p>