#K56447. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
You are given a string and your task is to count the frequency of each character in the string. For each unique character, print a line in the format (\texttt{character: count}) where the output lines are sorted in ascending order by the character's ASCII value. For example, if the input string is "abracadabra", the frequency counts should be printed as follows:
a: 5 b: 2 c: 1 d: 1 r: 2
If the input string is empty, no output should be produced.
inputFormat
The input consists of a single line read from standard input. The line is a string which may include spaces and special characters.
outputFormat
For each unique character in the input string, output a line in the format "character: count". The lines must be printed in ascending order based on the ASCII value of the character. If the input is empty, produce no output.## sample
abracadabra
a: 5
b: 2
c: 1
d: 1
r: 2
</p>