题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
s = input()#输入字符串 a = set()#创建空集合 for i in s:#遍历字符串中的字符 if (ord(i) >= 0 and ord(i) <= 127):#如果当前字符的ASCII码符合要求,则添加到集合中(重复元素不做任何处理) a.add(i) print(len(a))#输出集合的元素个数