5 lines
341 B
JavaScript
5 lines
341 B
JavaScript
var strs = require("fs").readFileSync("input.txt").toString().split("\n").filter((a)=>(a));
|
|
var pairs = strs.filter((str)=>(str.match(/([a-z]).*\1(?<!\1.*\1.*\1)(?!.*\1)/))).length;
|
|
var triples = strs.filter((str)=>(str.match(/([a-z]).*\1.*\1(?<!\1.*\1.*\1.*\1)(?!.*\1)/))).length;
|
|
console.log(strs.length, pairs, triples, pairs * triples);
|