— Day 5: Doesn’t He Have Intern-Elves For This? —
Santa needs help figuring out which strings in his text file are naughty or nice.
A nice string is one with all of the following properties:
-
It contains at least three vowels (
aeiouonly), likeaei,xazegov, oraeiouaeiouaeiou. -
It contains at least one letter that appears twice in a row, like
xx,abcdde(dd), oraabbccdd(aa,bb,cc, ordd). -
It does not contain the strings
ab,cd,pq, orxy, even if they are part of one of the other requirements.
For example:
-
ugknbfddgicrmopnis nice because it has at least three vowels (u...i...o...), a double letter (...dd...), and none of the disallowed substrings. -
aaais nice because it has at least three vowels and a double letter, even though the letters used by different rules overlap. -
jchzalrnumimnmhpis naughty because it has no double letter. -
haegwjzuvuyypxyuis naughty because it contains the stringxy. -
dvszwmarrgswjxmbis naughty because it contains only one vowel.
How many strings are nice?
Your puzzle answer was 258.
— Part Two —
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.
Now, a nice string is one with all of the following properties:
-
It contains a pair of any two letters that appears at least twice in
the string without overlapping, like
xyxy(xy) oraabcdefgaa(aa), but not likeaaa(aa, but it overlaps). -
It contains at least one letter which repeats with exactly one
letter between them, like
xyx,abcdefeghi(efe), or evenaaa.
For example:
-
qjhvhtzxzqqjkmpbis nice because is has a pair that appears twice (qj) and a letter that repeats with exactly one letter between them (zxz). -
xxyxxis 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. -
uurcxstgmygtbstgis naughty because it has a pair (tg) but no repeat with a single letter between them. -
ieodomkazucvgmuyis naughty because it has a repeating letter with one between (odo), but no pair that appears twice.
How many strings are nice under these new rules?
Your puzzle answer was 53.