B=input(‘请输入一行字符’)
big=0
smaller=0
space=0
number=0
other=0
for i in B:
if ‘A’<=i<=‘Z’:
big+=1
elif ‘a’<=i<=‘z’:
smaller+=1
elif i==’ ':
space+=1
elif ‘0’>=i<=‘9’:
number+=1
else:
other+=1
print(‘大写’,big)
print(‘小写’,smaller)
print(‘空格’,space)
print(‘数字’,number)
print(‘其他’,other)
结果
请输入一行字符FSDFfff46 ++
大写 4
小写 3
空格 2
数字 2
其他 2