#C14546. Count Unique Characters
Count Unique Characters
Count Unique Characters
Given a string S, your task is to count the occurrences of each non-whitespace character in S. Uppercase and lowercase letters are considered distinct. The output should be displayed as a Python dictionary formatted string where:
- Each key is a character (enclosed in single quotes).
- Each value is the number of times that character appears.
- The order of keys follows the order in which the characters first appear in the input.
For example, if the input is "Hello World", the output should be:
{'H': 1, 'e': 1, 'l': 3, 'o': 2, 'W': 1, 'r': 1, 'd': 1}
Whitespace characters are ignored.
inputFormat
The input consists of a single line containing the string S.
outputFormat
Print a dictionary (in Python literal format) representing the count of each character in S, ignoring whitespace. The keys must be enclosed in single quotes and appear in the order they first occur in S.
## sampleHello World
{'H': 1, 'e': 1, 'l': 3, 'o': 2, 'W': 1, 'r': 1, 'd': 1}