5 lines
384 B
JavaScript
5 lines
384 B
JavaScript
|
abba=(s)=>(s.split("").reduce((a, b, i, c)=>((i < 3) ? (a) : (((c[i] == c[i - 3]) && (c[i - 1] == c[i - 2]) && (c[i] != c[i - 1])) || a)), false));
|
||
|
var input = require("fs").readFileSync("input.txt").toString().replace(/\r/g, "");
|
||
|
var ips = input.split("\n").filter((s)=>(abba(s))).filter((s)=>(!s.match(/\[[^\]]+\]/g).reduce((a, b)=>(abba(b) || a), false)));
|
||
|
console.log(ips.length)
|