题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#统计个数,不要求顺序,采用HashSet即可 str1 = input() cur = 0 set1 = set() while(cur < len(str1)): set1.add(str1[cur]) cur += 1 sum1 = 0 for i in set1: sum1 += 1 print(sum1)
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#统计个数,不要求顺序,采用HashSet即可 str1 = input() cur = 0 set1 = set() while(cur < len(str1)): set1.add(str1[cur]) cur += 1 sum1 = 0 for i in set1: sum1 += 1 print(sum1)
相关推荐