题解 | #使用字典计数#
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
word = input()
result = {} #创建空字典
for n in word:
if n in result:
result[n] += 1 #如果字符存在,则计数+1
else:
result[n] = 1 #如果字符不存在,则创建该字符并将计数置为1
print(result)
