def count_char(str): string = ''.join(set(str)) #利用set无序不重复的性质,去重 count = 0 #计数器 for s in string: #遍历去重后的字符 if 0<= ord(s) <=127: #如果字符满足ASCII码的范围要求,则计数 count += 1 return count #函数返回计数的结果 str = input() print(count_char(str))
def count_char(str): string = ''.join(set(str)) #利用set无序不重复的性质,去重 count = 0 #计数器 for s in string: #遍历去重后的字符 if 0<= ord(s) <=127: #如果字符满足ASCII码的范围要求,则计数 count += 1 return count #函数返回计数的结果 str = input() print(count_char(str))