aboutsummaryrefslogtreecommitdiff
path: root/2022/01/puzzle-1.awk
diff options
context:
space:
mode:
Diffstat (limited to '2022/01/puzzle-1.awk')
-rwxr-xr-x2022/01/puzzle-1.awk5
1 files changed, 5 insertions, 0 deletions
diff --git a/2022/01/puzzle-1.awk b/2022/01/puzzle-1.awk
new file mode 100755
index 0000000..406a663
--- /dev/null
+++ b/2022/01/puzzle-1.awk
@@ -0,0 +1,5 @@
+#!/usr/bin/awk -f
+
+/[0-9]+/ { acc += $1; next }
+ { if (acc > max) max = acc; acc = 0 }
+END { print max }