#C14369. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
Given a string, your task is to count the frequency of each alphanumeric character in the string. Ignore any spaces or punctuation, and treat uppercase and lowercase letters as identical. The frequencies should be printed with the characters in sorted order (in ascending order according to their ASCII values).
For example, given the input string "Hello, World!", after converting to lowercase and ignoring non-alphanumeric characters, the frequency dictionary would be: ( { 'd':1, 'e':1, 'h':1, 'l':3, 'o':2, 'r':1, 'w':1 } ).
Make sure to read input from standard input and write the output to standard output. The output format is to print each key and its frequency on a separate line, with a space separating the character and its count. If there are no alphanumeric characters in the string, output nothing.
inputFormat
Input is provided via standard input as a single line containing a string. The string may contain letters, digits, spaces, and punctuation.
outputFormat
For each alphanumeric character present in the input string, output a line with the character and its frequency count separated by a space. The characters must be output in ascending order (sorted by their ASCII value). If the input string does not contain any alphanumeric characters, do not produce any output.## sample
Hello, World!
d 1
e 1
h 1
l 3
o 2
r 1
w 1
</p>