题解 | #使用字典计数#
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
str1 = input()
dict1 = {}
for i in str1:
if i in dict1:
dict1[i] = dict1[i] +1
else:
dict1[i] = 1
print(dict1)
dict1 = {}
for i in str1:
if i in dict1:
dict1[i] = dict1[i] +1
else:
dict1[i] = 1
print(dict1)