Advertisement
whoisYeshua

Yandex Контест node template

Jun 23rd, 2022
1,090
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. });
Advertisement
RAW Paste Data Copied
Advertisement