题解 | #计算某字符出现次数#
计算某字符出现次数
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)