-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f32fa53
commit f6baeb5
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Any | ||
|
||
|
||
def puzzle(input: str) -> Any: | ||
lines = [line.strip() for line in input.splitlines()] | ||
nice_strings = 0 | ||
for line in lines: | ||
vowel_count = 0 | ||
for char in line: | ||
if char in "aeiou": | ||
vowel_count += 1 | ||
if vowel_count < 3: | ||
continue | ||
|
||
for i in range(len(line) - 1): | ||
if line[i] == line[i + 1]: | ||
break | ||
else: | ||
continue | ||
|
||
if any(substring in line for substring in ["ab", "cd", "pq", "xy"]): | ||
continue | ||
nice_strings += 1 | ||
return nice_strings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Any | ||
|
||
|
||
def puzzle(input: str) -> Any: | ||
lines = [line.strip() for line in input.splitlines()] | ||
nice_strings = 0 | ||
for line in lines: | ||
first = False | ||
for i in range(len(line) - 3): | ||
sub = line[i:i + 2] | ||
if sub in line[i + 2:]: | ||
first = True | ||
break | ||
if not first: | ||
continue | ||
second = False | ||
for i in range(len(line) - 2): | ||
if line[i] == line[i + 2]: | ||
second = True | ||
break | ||
if second: | ||
nice_strings += 1 | ||
return nice_strings |