题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
import sys import re def statistics(str): # 字符串去空格 # 字符串检查ASCII码范围 # 字符串去重 l_result = [] for c in str: if c != '\n' and c not in l_result: l_result.append(c) # 统计长度 return len(l_result) if __name__ == '__main__': str = sys.stdin.readline().strip() result = statistics(str) print(result)