#C14962. Case-Insensitive Character Frequency Count
Case-Insensitive Character Frequency Count
Case-Insensitive Character Frequency Count
You are given a string, and your task is to count the frequency of each character in the string in a case insensitive manner. In other words, uppercase and lowercase versions of the same letter are considered identical. The output should be a dictionary-like string representation (using single quotes for keys) that preserves the order in which each unique character first appears in the string.
Important: The resulting dictionary should exactly match the format as shown in the examples. Do not include any additional spaces or newlines in the output other than what is specified.
Examples:
- Input:
aabbcc
→ Output:{'a': 2, 'b': 2, 'c': 2}
- Input:
AaBbCc
→ Output:{'a': 2, 'b': 2, 'c': 2}
- Input:
abc abc
→ Output:{'a': 2, 'b': 2, 'c': 2, ' ': 1}
- Input:
a!@#A!@#b!@#B!@#
→ Output:{'a': 2, '!': 4, '@': 4, '#': 4, 'b': 2}
- Input:
Python Programming!
→ Output:{'p': 2, 'y': 1, 't': 1, 'h': 1, 'o': 2, 'n': 2, ' ': 1, 'r': 2, 'g': 2, 'a': 1, 'm': 2, 'i': 1, '!': 1}
inputFormat
The input consists of a single line, which is the string whose characters you need to count. The string may contain letters, digits, spaces, and special characters.
outputFormat
Output a single line containing a dictionary-like string that represents the frequency of each character in the input string. Convert all alphabetical characters to lowercase before counting, and the order of keys in the output should be in the order of their first appearance in the string. Use the Python dictionary literal format with single quotes.
## sampleaabbcc
{'a': 2, 'b': 2, 'c': 2}