aboutsummaryrefslogtreecommitdiff
path: root/2017/01/puzzle-1.sh
diff options
context:
space:
mode:
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