aboutsummaryrefslogtreecommitdiff
path: root/2017/01/puzzle-1.sh
blob: 2659faed61d3104912300196f27311f0d06f3eb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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