题解 | #使用字典计数#
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
import sys
a=input()
b=[]
c={}
for i in a:
b.append(i)
for j in b:
c.setdefault(j,b.count(j))
print(c)
使用字典计数
https://www.nowcoder.com/practice/74f7e7f2344f4754bc56d862838cbfc3
import sys
a=input()
b=[]
c={}
for i in a:
b.append(i)
for j in b:
c.setdefault(j,b.count(j))
print(c)
相关推荐