题目:
思路:
先按候选人生成字典并给初始值
后输入的取字典里找,找不到就是不合格的票
找到了字典+1
提交:
let line
while(line = Number(readline())) {
let persons = {}
readline().trim().split(' ').forEach(item => {
persons[item] = 0
})
let line2 = Number(readline())
let invalidCount = 0
readline().trim().split(' ').forEach(item => {
if (persons[item] !== undefined) {
persons[item]++
} else {
invalidCount++
}
})
for (let k in persons) {
console.log(k + ' : ' + persons[k])
}
console.log('Invalid : ' + invalidCount)
}