题解 | 使用字典计数
word = input()
dict = {}
for i in range(len(word)):
if word[i] not in dict.keys():
dict[word[i]] = 1
else:
dict[word[i]] += 1
print(dict)
word = input()
dict = {}
for i in range(len(word)):
if word[i] not in dict.keys():
dict[word[i]] = 1
else:
dict[word[i]] += 1
print(dict)
相关推荐