题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
def str_tongji(n):
str1 = set(n) #利用set函数对字符串n进行无序去重
count = 0
for i in str1: #对去重后的字符串进行遍历
if 0<= ord(i)<=127: #判断字符串是否属于ascii之中
count+=1 #满足要求计数
return count
# n=set(input())
n = ''.join(set(input())) #!!!set完成后数据会变成set格式,需要join函数将字符串变成str格式
count = str_tongji(n)
print(count)