[Python/2015] Move solutions into .py files
This commit is contained in:
parent
8c2be5fb77
commit
94dd3ae399
52 changed files with 996 additions and 3314 deletions
19
Python/2015/05.py
Normal file
19
Python/2015/05.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2015, 5)
|
||||
|
||||
|
||||
def is_nice1(x):
|
||||
return bool(re.match(r"^(?=(.*[aeiou]){3,})(?=.*(?P<x>.)(?P=x)).*$", x)) and not any(
|
||||
e in x for e in ["ab", "cd", "pq", "xy"]
|
||||
)
|
||||
|
||||
|
||||
print(sum(map(is_nice1, input.splitlines())))
|
||||
|
||||
|
||||
def is_nice2(x):
|
||||
return bool(re.match(r"^(?=.*(?P<a>..).*(?P=a))(?=.*(?P<b>.).(?P=b)).*$", x))
|
||||
|
||||
|
||||
print(sum(map(is_nice2, input.splitlines())))
|
Loading…
Add table
Add a link
Reference in a new issue