aoc

Advent of Code
git clone https://git.parazyd.org/aoc
Log | Files | Refs

01.sh (203B)


      1 #!/bin/sh
      2 
      3 elves=""
      4 elf=0
      5 
      6 while read line; do
      7 	if [ -z "$line" ]; then
      8 		elves="$elves $elf"
      9 		elf=0
     10 		continue
     11 	fi
     12 	elf=$(( elf + $line ))
     13 done
     14 
     15 printf "%s" "$elves" | tr ' ' '\n' | sort -n | tail -n1