adventofcode-2023/day_01/solution_01.nim

13 lines
289 B
Nim

import std/[re, strutils]
var res = 0
for line in readFile("input_01.txt").splitLines:
if line.strip.len > 0:
var digits = findAll(line, re"\d")
var number = parseInt(digits[0] & digits[^1])
res += number
#echo $digits, $number
echo "Result: ", $res