while True:
str = input("请输入字符串:")
alp = 0
spa = 0
num = 0
oth = 0
if str in 'nN':
break
else:
for c in str:
if c == ' ':
spa = spa + 1
continue
if 'a' <= c.lower() <= 'z':
alp = alp + 1
continue
if '0' <= c <= '9':
num = num + 1
continue
else:
oth = oth + 1
print("该字符串中字母的数目为:{}".format(alp))
print("该字符串中数字的数目为:{}".format(num))
print("该字符串中空格的数目为:{}".format(spa))
print("该字符串中其他字符的数目为:{}".format(oth))