#C12443. Character Occurrence Counter
Character Occurrence Counter
Character Occurrence Counter
Given a string s, count the occurrences of each character in s while treating uppercase and lowercase letters as the same. In other words, the function should consider 'A' and 'a' as the same character.
For example, if s = "Programming", the expected output is:
{'p': 1, 'r': 2, 'o': 1, 'g': 2, 'a': 1, 'm': 2, 'i': 1, 'n': 1}
The problem can be mathematically defined as follows:
Given a string \( s \), compute a function \( f: \Sigma \to \mathbb{N} \) such that for each character \( c \) (ignoring case), \( f(c) \) equals the number of times any variant of \( c \) appears in \( s \).
inputFormat
The input consists of a single line string. The string may contain letters, digits, spaces, and symbols. Note that uppercase and lowercase letters must be treated as the same.
outputFormat
Output a Python-like dictionary where the keys are the characters (in lowercase) and the values are the counts of those characters in the order of their first appearance. The format should exactly match the following example:
{'p': 1, 'r': 2, 'o': 1, 'g': 2, 'a': 1, 'm': 2, 'i': 1, 'n': 1}
Programming
{'p': 1, 'r': 2, 'o': 1, 'g': 2, 'a': 1, 'm': 2, 'i': 1, 'n': 1}