题解 | #计算某字符出现次数#
计算某字符出现次数
https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let rlArr = [] function callback([str, char]) { str = str.toUpperCase() char = char.toUpperCase() const count = str.split(char).length - 1 console.log(count) } rl.on('line', function (line) { rlArr.push(line) if (rlArr.length === 2) { callback([rlArr[0], rlArr[1]]) } });