题解 | #统计一句话中重复单词的个数#
统计一句话中重复单词的个数
http://www.nowcoder.com/questionTerminal/2128e598b5a5407195c31175b5b33360
使用字典快速解决 str_n = input() dic = {} for i in str_n: if i == " ": continue key = i dic[key] = dic.get(key,0) + 1 for i in dic: print(i+":"+str(dic[i]))