#C13791. Character Count
Character Count
Character Count
You are given a string s. Your task is to count the number of occurrences of each character in the string. The result should be output as a dictionary (or map) representation showing each unique character and its count. Note that the order of the characters in the output should be the same as the order of their first appearance in the input.
For each character c in the string, calculate the count using the formula:
\( count(c) = \text{number of times c appears in } s \)
Be careful to preserve the case sensitivity (i.e., 'A' and 'a' are considered different) and include special characters as they appear.
inputFormat
The input consists of a single line string s. The string may contain letters, digits, whitespace, or special characters.
outputFormat
Output a dictionary representation of the character counts. The format should be as follows (using single quotes):
{'A': 1, 'a': 1, ...}
If the input string is empty, output {}
.
Programming
{'P': 1, 'r': 2, 'o': 1, 'g': 2, 'a': 1, 'm': 2, 'i': 1, 'n': 1}