#C14760. Case-Insensitive Character Frequency Counter
Case-Insensitive Character Frequency Counter
Case-Insensitive Character Frequency Counter
You are given a string. Your task is to count the frequency of each character in the string while ignoring case differences.
The output should be displayed as a dictionary where:
- The keys are the characters in lowercase.
- The values are the number of times each character appears in the string.
Note that all characters, including whitespace and special characters, are to be counted as they appear (after converting alphabetic characters to lowercase). For example, if the input is AaBb
, then the output should be {'a': 2, 'b': 2}
.
The dictionary must follow the insertion order of the first occurrence of each character.
inputFormat
The input consists of a single line containing a string. This string may contain letters, digits, whitespace, and special characters.
Note: The input is provided via standard input (stdin).
outputFormat
Output the resulting dictionary to standard output (stdout) that maps each lowercase character (based on its first occurrence in the input) to its frequency. The dictionary should be printed in the following format:
{'c1': count1, 'c2': count2, ...}## sample
a
{'a': 1}