Florian Bouillon 72ca03a2f1
feat: Add the four first days of 2023
Signed-off-by: Avior <github@avior.me>
2023-12-03 23:31:52 +01:00

11 lines
338 B
TypeScript

// note: this runs using bun!
const file = Bun.file('./input.txt')
const text = await file.text()
const res = text.split('\n').filter((it) => !!it).map((it) => {
const nums = it.replace(/[a-z]/g, '')
const first = nums[0]
const last = nums[nums.length - 1]
return parseInt(first + last)
}).reduce((p, c) => p + c, 0)
console.log(res)