题解 | #统计字符#

统计字符

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

s = input()
count1,count2,count3,count4 = 0,0,0,0
for i in s:
    if i.isalpha():
        count1 += 1
    elif i.isdigit():
        count3 += 1
    elif i == ' ':
        count2 += 1
    else:
        count4 += 1

print(count1)
print(count2)
print(count3)
print(count4)

全部评论

相关推荐

10-17 13:54
上海大学 运营
雾凇岛:这还说什么了,冲了兄弟们
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务