diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2021-11-24 22:25:42 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2021-11-24 22:25:42 +0000 |
commit | a7a6b86002b595bc167af72606b14c67ed1bdf8f (patch) | |
tree | bff94329cf969bd9df68d3b9782fee2107db56c2 /11/solution_own.py | |
download | aoc2015-a7a6b86002b595bc167af72606b14c67ed1bdf8f.tar.gz aoc2015-a7a6b86002b595bc167af72606b14c67ed1bdf8f.tar.xz aoc2015-a7a6b86002b595bc167af72606b14c67ed1bdf8f.zip |
init commit
Diffstat (limited to '11/solution_own.py')
-rw-r--r-- | 11/solution_own.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/11/solution_own.py b/11/solution_own.py new file mode 100644 index 0000000..0c45bc0 --- /dev/null +++ b/11/solution_own.py @@ -0,0 +1,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) |