mirror of
https://github.com/fredrikr79/advent_of_code.git
synced 2025-12-28 05:00:21 +01:00
1.1 KiB
1.1 KiB
part 1
i first solved it this morning using vim, since i had no idea how to use regex in uiua. this is how i did it in vim (with some regex help from kagi assistant):
:e "input"
100J # there are few lines, join them all
:%s/\(mul(\d\+,\d\+)\)\|\(.\)/\1/g # find all mul expressions
:%s/mul(\(\d+\),\(\d+\))/\1*\2+/g # replace all mul expressions with the operands multiplied together with a + appended
$x # remove last +
:'<,'>s/.*/\=eval(submatch(0)) # evaluate the expression
my uiua solution is very similar