
Given a string s, return a mapping of each character to the number of times it appears in the string. The function should treat every character as distinct, including spaces, digits, punctuation, and differences in letter case.
Example 1:
Input: s = "hello"
Output: {"h": 1, "e": 1, "l": 2, "o": 1}
Explanation: The character 'l' appears twice and all other characters appear once.
Example 2:
Input: s = "aA a"
Output: {"a": 2, "A": 1, " ": 1}
Explanation: Uppercase and lowercase letters are counted separately, and the space is also counted.
0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuationsGiven a string s, return a mapping of each character to the number of times it appears in the string. The function should treat every character as distinct, including spaces, digits, punctuation, and differences in letter case.
Example 1:
Input: s = "hello"
Output: {"h": 1, "e": 1, "l": 2, "o": 1}
Explanation: The character 'l' appears twice and all other characters appear once.
Example 2:
Input: s = "aA a"
Output: {"a": 2, "A": 1, " ": 1}
Explanation: Uppercase and lowercase letters are counted separately, and the space is also counted.
0 <= len(s) <= 10^5s may contain letters, digits, spaces, and punctuations