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] ]
- ]
- Character extend [
- " XXX: assuming only letters "
- priority [
- ^self isLowercase ifTrue: [ self asInteger - 96 ]
- ifFalse: [ self asInteger - 38 ] " - 64 + 26 "
- ]
- ]
- "
- | Mainline
- "
- part2 := 0.
- sacks := ReadStream on: (stdin contents lines apply: #asSet).
- [ sacks atEnd ] whileFalse: [
- badge := (sacks next: 3) fold: [:a :b | a & b].
- part2 := part2 + badge anyOne priority
- ].
- ('Part 2: %1' % {part2}) displayNl.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement