Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/gst -q
- Collection extend [
- apply: method [ ^self collect: [:x | x perform: method] ]
- sum [ ^self inject: 0 into: [:a :b | a + b] ]
- ]
- elves := stdin contents tokenize: '\n\n'.
- elf_cal := (elves collect: [:x | (x substrings apply: #asNumber) sum]) sorted.
- ('Part 1: %1' % {elf_cal last}) displayNl.
- ('Part 2: %1' % {(elf_cal last: 3) sum}) displayNl.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement