题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#动态创建字典,统计字典中的元素数目,即符合题目要求 s = input() b={} count = 0 for i in range(0,len(s)): key = s[i] b[key] = b.get(key,0) + 1 for i in b: count +=1 print(count)
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#动态创建字典,统计字典中的元素数目,即符合题目要求 s = input() b={} count = 0 for i in range(0,len(s)): key = s[i] b[key] = b.get(key,0) + 1 for i in b: count +=1 print(count)
相关推荐