21 lines
475 B
JavaScript
21 lines
475 B
JavaScript
const { Glib } = require('../../lib');
|
|
|
|
const parse = (input) => Glib.fromLines(input).map((p) => p.split(' ')).array;
|
|
|
|
module.exports = {
|
|
'1': (input) =>
|
|
parse(input).filter((words) => words.set.size === words.length).length,
|
|
'2': (input) =>
|
|
parse(input).filter((words) => {
|
|
return (
|
|
words.length ===
|
|
words.map((i) =>
|
|
i
|
|
.split('')
|
|
.sort()
|
|
.join(),
|
|
).set.size
|
|
);
|
|
}).length,
|
|
};
|