题解 | #计算某字符出现次数#

计算某字符出现次数

https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1

import sys

lines = []
count = 0

for line in sys.stdin:
    lines.append(line)
A_or_a = lines[1][0]
for i in lines[0]:
    # print(i)
    if i == A_or_a :
        count += 1
    elif i == A_or_a.lower():
        count += 1
    elif i == A_or_a.upper():
        count += 1
print(count)

全部评论

相关推荐

shtdbb_:还不错,没有让你做了笔试再挂你
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务