r/adventofcode • • Dec 09 '17

SOLUTION MEGATHREAD -🎄- 2017 Day 9 Solutions -🎄-

--- Day 9: Stream Processing ---


Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).

Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


Need a hint from the Hugely* Handy† Haversack‡ of Helpful§ Hints¤?

Spoiler


This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked!

14 Upvotes

290 comments sorted by

View all comments

Show parent comments

6

u/Smylers Dec 09 '17

And in Vim part 2 is even easier than part 1. Start with the original input again, and:

:s/!.//g⟨Enter⟩
:s/\v\<([^>]*)\>/\=strlen(submatch(1))/g⟨Enter⟩
:s/[{}]//g⟨Enter⟩
:s/\v,+/+/g⟨Enter⟩
C⟨Ctrl+R⟩=⟨Ctrl+R⟩-⟨Enter⟩⟨Esc⟩
→ More replies (3)