SHOW:
|
|
- or go back to the newest paste.
1 | const readline = require('readline'); | |
2 | ||
3 | const rl = readline.createInterface({ | |
4 | input: process.stdin | |
5 | }); | |
6 | ||
7 | let lines = []; | |
8 | rl.on('line', (line) => { | |
9 | lines.push(line); | |
10 | }).on('close', () => { | |
11 | const [jewels, stones] = lines | |
12 | let result = 0; | |
13 | for (let i = 0; i < stones.length; i++) { | |
14 | if (jewels.includes(stones.charAt(i))) { | |
15 | ++result; | |
16 | } | |
17 | } | |
18 | process.stdout.write(result.toString()); | |
19 | }); |