题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
string = input().lower() val = input().lower() summ = 0 for v in string: if v == val: summ += 1 print(summ)
- str.lower()字符串小写;str.upper()大写
- 换行输入,多次input()接收不同行输入