题解 | #统计字符#

统计字符

https://www.nowcoder.com/practice/539054b4c33b4776bc350155f7abd8f5

my_str = input()
count_a = 0
count_s = 0
count_d = 0
count_o = 0

for i in my_str:
    if i.isalpha():
        count_a += 1
    elif i.isspace():
        count_s += 1
    elif i.isdigit():
        count_d += 1
    else:
        count_o +=1

print(count_a)
print(count_s)
print(count_d)
print(count_o)

全部评论

相关推荐

11-24 19:04
已编辑
湖南工商大学 Java
点赞 评论 收藏
分享
Noob1024:一笔传三代,人走笔还在
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务