jsadvent/solutions/2015/5.js
2020-12-10 02:33:00 -06:00

16 lines
408 B
JavaScript

const { Glib } = require('../../lib');
module.exports = {
'1': (input) =>
Glib.fromLines(input).filter(
(string) =>
!string.match(/(ab|cd|pq|xy)/) &&
string.match(/[aeiou].*[aeiou].*[aeiou]/) &&
string.match(/(.)\1/),
).length,
'2': (input) =>
Glib.fromLines(input).filter(
(string) => string.match(/(..).*\1/) && string.match(/(.).\1/),
).length,
};