BC143 [NOIP2018]标题统计
思路:
step1:输入字符;
step2:创建数字串和计数器;
step3:遍历n,如果属于字母和在shu里面,计数器+1,最后打印结果;
代码如下:
n = input()
shu = '0123456789'
count = 0
for i in n:
if i.isalpha() or i in shu:
count += 1
print(count)
n = input()
shu = '0123456789'
count = 0
for i in n:
if i.isalpha() or i in shu:
count += 1
print(count)