Add: 10->12, 17

This commit is contained in:
PedroEdiaz
2025-10-29 23:26:33 -06:00
parent 4932f78954
commit 5db4f5c015
4 changed files with 173 additions and 0 deletions

47
2015/11.py Normal file
View File

@@ -0,0 +1,47 @@
import re
input = "cqjxjnds"
def match(pattern, string):
return re.search(pattern, string) != None
def rule1(input):
matched = 0
last = '-'
for c in input:
if ord(c) == ord(last) + 1:
matched += 1
if matched == 3:
return True
else:
matched = 1
last = c
return False
def increment(input):
res = ""
carry = 1
for c in reversed(input):
if carry != 0:
if c=='z':
c = chr(ord('a'))
carry = carry
else:
c = chr(ord(c)+carry)
carry = 0
res = c + res
return res
for i in range(10):
while not (rule1(input) and match(r"(.)\1.*(.)\2", input) and not match(r"i|o|l", input)):
input = increment(input)
print(input)
input = increment(input)