From d1d98a31f9a62e1497bde38178b22075471eb3b1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 2 Dec 2023 00:04:27 +0100 Subject: Add 2023 day 1 solutions --- 2023/01/puzzle-2.an | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 2023/01/puzzle-2.an (limited to '2023/01/puzzle-2.an') diff --git a/2023/01/puzzle-2.an b/2023/01/puzzle-2.an new file mode 100755 index 0000000..81638af --- /dev/null +++ b/2023/01/puzzle-2.an @@ -0,0 +1,17 @@ +#!/usr/local/bin/andy + +sed -E ' + s/one/&1&/g + s/two/&2&/g + s/three/&3&/g + s/four/&4&/g + s/five/&5&/g + s/six/&6&/g + s/seven/&7&/g + s/eight/&8&/g + s/nine/&9&/g +' input +| tr -d a-z +| sed -E 's/(.).*(.)/\1\2/; s/^.$/&&/' +| paste -sd+ +| bc -- cgit v1.2.3