aboutsummaryrefslogtreecommitdiff
path: root/2022/01/puzzle-2.awk
blob: 11f46c0b7e04ecf9e4815f52c0f19f1ce1493025 (plain) (blame)
1
2
3
4
5
#!/usr/bin/gawk -f

/[0-9]+/ { acc += $1 }
!/./     { max[++i] = acc; acc = 0 }
END      { asort(max); print max[i] + max[i - 1] + max[i - 2] }