blob: 0c45bc05b413b6a04f8acdbc45aab88493e41751 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
def valid(p: str) -> bool:
if {'i', 'o', 'l'}.intersection(set(p)):
return False
def next_password(p: str) -> str:
if p[-1] == 'z':
return next_password(p[:-1]) + 'a'
else:
return p[:-1] + chr(ord(p[-1]) + 1)
pw = next_password('cqjxjnds')
while not valid(pw):
pw = next_password(pw)
print(pw)
pw = next_password(pw)
while not valid(pw):
pw = next_password(pw)
print(pw)
|