const input = await Deno.readTextFile("input.txt"); const lines = input.split("\n"); const numbers = lines.map(line => { const numbers = line.split("").filter(c => c.match(/[0-9]/)); return parseInt(numbers[0] + numbers[numbers.length - 1]); }); console.log(numbers.reduce((a, b) => a + b));