题解 | #字符个数统计#
字符个数统计
http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#import sys
while True:
try:
s = input()
a_set = set() #使用集合去重特性
for a in s:
if 0 <= ord(a) < 128: #字符转ascii码ord. ascii码转字符chr
a_set.add(a)
print(len(a_set))
except:
#print(sys.exc_info())
break
查看13道真题和解析
小天才公司福利 1152人发布