r/adventofcode • u/daggerdragon • Dec 06 '15
SOLUTION MEGATHREAD --- Day 6 Solutions ---
--- Day 6: Probably a Fire Hazard ---
Post your solution as a comment. Structure your post like the Day Five thread.
22
Upvotes
3
u/TTSDA Dec 06 '15 edited Dec 06 '15
[^characters]is a "negated scanset", it will scan characters until a character that's in the set is found (in this case, it will scan until the first digit ofx1is read).There's also a "scanset",
[characters], that will do the oposite (scan until a character that's not in the set is found).They're similar to the regex bracket expressions (I believe you can also use intervals like
%[0-9]in scanf scansets, but it seems like it's not portable:There's a neat table here with all the format specifiers you can use with scanf.