-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10816.js
41 lines (33 loc) · 838 Bytes
/
10816.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const { SourceMap } = require("module");
var readline = require("readline");
var r = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
r.on("line", function (line) {
input.push(line);
}).on("close", function () {
main(input);
process.exit();
});
function main(input) {
const [N, deck, M, cardList] = input;
const sangunMap = {};
const result = [];
deck.split(" ").forEach(card => {
if(sangunMap[card] === undefined){
sangunMap[card] = 1;
return;
}
++sangunMap[card];
});
cardList.split(" ").forEach(card => {
if(sangunMap[card] === undefined){
result.push("0");
return;
}
result.push(sangunMap[card]);
})
console.log(result.join(" "))
}