aboutsummaryrefslogtreecommitdiff
path: root/2017/01/puzzle-1.sh
diff options
context:
space:
mode:
authorThomas Voss <thomasvoss@live.com> 2021-12-03 14:14:40 +0100
committerThomas Voss <thomasvoss@live.com> 2021-12-03 14:14:40 +0100
commit13f17fb1180375e64e02d1a3b9bc5faacc14c588 (patch)
tree51b66a7d0dcd19372b0369a4c93cfe7b278a2f96 /2017/01/puzzle-1.sh
parentcacd416845e12bde1840508532474cb45e50a334 (diff)
Add 2017 Day 1 solutions
Diffstat (limited to '2017/01/puzzle-1.sh')
-rwxr-xr-x2017/01/puzzle-1.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/2017/01/puzzle-1.sh b/2017/01/puzzle-1.sh
new file mode 100755
index 0000000..2659fae
--- /dev/null
+++ b/2017/01/puzzle-1.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+sed '
+:l
+s/\(.\)\1/<\1>\1/g
+tl
+s/^\(.\)\(.*\)\1$/<\1>\2/
+s/>[0-9]*</+/g
+s/^[0-9]*<//
+s/>[0-9]*$//
+' input | bc