#C14710. Character Frequency Counter
Character Frequency Counter
Character Frequency Counter
You are given a string which may contain letters, digits, spaces, and special characters. Your task is to count the frequency of each character in the string in a case-sensitive manner. The order of output should be the order in which each distinct character appears in the input.
For example, if the input is "hello", you should output:
h: 1 e: 1 l: 2 o: 1
If the input is an empty string, print nothing.
Note: The input will be taken from stdin
and the result should be printed to stdout
.
inputFormat
The input consists of a single line containing the string.
The string may include spaces and special characters.
outputFormat
For each distinct character in the input string (in the order of their first occurrence), print a line in the format:
character: count
If the string is empty, output nothing.
## samplehello
h: 1
e: 1
l: 2
o: 1
</p>