题解 | #计算某字符出现次数#
计算某字符出现次数
http://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
const line1 = readline();
const line2 = readline();
function func(str, char) {
let num = 0;
const arr = str.split('');
arr.forEach((item) => {
if (item.toLowerCase() === char.toLowerCase()) num++;
});
return num;
}
print(func(line1, line2));