Task: | Sanalista |
Sender: | motsgar |
Submission time: | 2020-09-30 15:22:16 +0300 |
Language: | Node.js |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.45 s | details |
#2 | ACCEPTED | 0.45 s | details |
#3 | ACCEPTED | 0.45 s | details |
Code
const readline = require('readline'); const input = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false }); let output = 0; let inputAmount = 0; let inputtedValues = 0; let firstLine = true; input.on('line', function (line) { if (firstLine) { inputAmount = parseInt(line); firstLine = false; } else { let characters = {}; for (let i = 0; i < line.length; i++) { if (characters[line.charAt(i)] != undefined) { characters[line.charAt(i)]++; } else characters[line.charAt(i)] = 1; } let hasEven = true; Object.values(characters).forEach(val => { if (val % 2 != 0) hasEven = false; }); if (hasEven) output++; inputtedValues++; if (inputtedValues == inputAmount) { console.log(output); process.exit(0); } } });
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
15 |
Test 2
Verdict: ACCEPTED
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
42 |
Test 3
Verdict: ACCEPTED
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
70 |