题解 | #使用字典计数#
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
str1=input('')
word=[]
num=[]
for x in str1:
if x not in word:
word.append(x)
for y in word:
count=0
for z in str1:
if(y==z):
count +=1
num.append(count)
print(dict(zip(word,num)))
查看13道真题和解析