aboutsummaryrefslogtreecommitdiff
path: root/2020/10/puzzle-1.sh
blob: f31af0211ddd2589cbf41725172fea69fca25acd (plain) (blame)
1
2
3
4
5
6
7
#!/usr/bin/env sh

sort -n input | awk '
BEGIN  { o = t = 1 }
NR > 1 { if ($0 - prev == 1) o++; else if ($0 - prev == 3) t++; }
       { prev = $0 }
END    { print o * t }'