Skip to content

Commit bf2e82d

Browse files
committed
Added README for day 5.
1 parent a03f70f commit bf2e82d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

day05/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# [Day 5: Doesn't He Have Intern-Elves For This?](http://adventofcode.com/day/5)
2+
3+
## --- Part One ---
4+
5+
Santa needs help figuring out which strings in his text file are naughty or nice.
6+
7+
A __nice string__ is one with all of the following properties:
8+
9+
- It contains at least three vowels (aeiou only), like aei, xazegov, or aeiouaeiouaeiou.
10+
- It contains at least one letter that appears twice in a row, like xx, abcdde (dd), or aabbccdd (aa, bb, cc, or dd).
11+
- It does __not__ contain the strings ab, cd, pq, or xy, even if they are part of one of the other requirements.
12+
13+
For example:
14+
15+
- ugknbfddgicrmopn is nice because it has at least three vowels (u...i...o...), a double letter (...dd...), and none of the disallowed substrings.
16+
- aaa is nice because it has at least three vowels and a double letter, even though the letters used by different rules overlap.
17+
- jchzalrnumimnmhp is naughty because it has no double letter.
18+
- haegwjzuvuyypxyu is naughty because it contains the string xy.
19+
- dvszwmarrgswjxmb is naughty because it contains only one vowel.
20+
21+
How many strings are nice?
22+
23+
Your puzzle answer was _236_.
24+
25+
## --- Part Two ---
26+
27+
Realizing the error of his ways, Santa has switched to a better model of determining whether a string is naughty or nice. None of the old rules apply, as they are all clearly ridiculous.
28+
29+
Now, a nice string is one with all of the following properties:
30+
31+
- It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).
32+
- It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.
33+
34+
For example:
35+
36+
- qjhvhtzxzqqjkmpb is nice because is has a pair that appears twice (qj) and a letter that repeats with exactly one letter between them (zxz).
37+
- xxyxx is nice because it has a pair that appears twice and a letter that repeats with one between, even though the letters used by each rule overlap.
38+
- uurcxstgmygtbstg is naughty because it has a pair (tg) but no repeat with a single letter between them.
39+
- ieodomkazucvgmuy is naughty because it has a repeating letter with one between (odo), but no pair that appears twice.
40+
41+
How many strings are nice under these new rules?
42+
43+
Your puzzle answer was _51_.

0 commit comments

Comments
 (0)