17 lines
403 B
JavaScript
17 lines
403 B
JavaScript
|
const fs = require('fs');
|
||
|
const file = fs.readFileSync(__dirname + '/input.txt').toString('utf-8');
|
||
|
const groups = file.split('\n\n');
|
||
|
|
||
|
let total = 0;
|
||
|
|
||
|
groups.forEach(answers => {
|
||
|
answers = answers
|
||
|
.replace(/\n/g, '')
|
||
|
.split('');
|
||
|
|
||
|
let answered = {};
|
||
|
answers.forEach(a => answered[a] = true);
|
||
|
total += Object.keys(answered).length;
|
||
|
});
|
||
|
|
||
|
console.log(`Total: ${total}`);
|