#C11865. Character Frequency Counter

    ID: 41228 Type: Default 1000ms 256MiB

Character Frequency Counter

Character Frequency Counter

You are given a string s via standard input. Your task is to compute the frequency of each character in the string. Character frequency is case-sensitive, i.e. uppercase and lowercase letters are considered as different characters.

For the output, print each unique character and its corresponding count on a separate line in the format:

character: count

The characters should be output in ascending order based on their ASCII values. For example, if the input is Hello, World!, the sorted order (by ASCII) is: space, !, ,, H, W, d, e, l, o, r.

If the input is an empty string, do not print anything.

Note: If a line in the output seems to start with a whitespace (for the space character), that is expected.

The mathematical notion of frequency can be formally defined as follows: if we let \( f(c) \) represent the frequency of character \( c \) in the string, then: \[ f(c) = \#\{ i \mid s_i = c \} \]

inputFormat

The input consists of a single string s provided via standard input. The string may include spaces, punctuation, and special characters. It is read as a whole line.

outputFormat

For each unique character in the string, output a line in the format character: count, where character is the character and count is its frequency. The output lines must be sorted in ascending order by the ASCII values of the characters. If the input is empty, output nothing.

## sample
Hello, World!
 : 1

!: 1 ,: 1 H: 1 W: 1 d: 1 e: 1 l: 3 o: 2 r: 1

</p>