|
import fs from "node:fs";
|
|
|
|
let data = fs.readFileSync("input", "utf8");
|
|
|
|
let lines = data
|
|
.split("\n")
|
|
.map(l => l.split("").filter(c => +c == c))
|
|
.map(l => [l[0], l[l.length - 1]])
|
|
.map(l => l.join(""))
|
|
.map(n => Number(n))
|
|
.reduce((acc, n) => acc + n);
|
|
|
|
console.log(lines);
|