diff options
| author | Yitzchak Scott-Thoennes <sthoenna@gmail.com> | 2025-07-23 17:15:21 -0400 |
|---|---|---|
| committer | Yitzchak Scott-Thoennes <sthoenna@gmail.com> | 2025-07-23 17:15:21 -0400 |
| commit | 99c4e905c974e2e92e238c10cbfc771e89b6cc90 (patch) | |
| tree | 7b9b94dc1bb5ba419d0a9f383e60b785b2e99f20 /challenge-331/ysth/python/ch-2.py | |
| parent | fa6ac79755faeac2482b731861634bf63036ff3a (diff) | |
| download | perlweeklychallenge-club-99c4e905c974e2e92e238c10cbfc771e89b6cc90.tar.gz perlweeklychallenge-club-99c4e905c974e2e92e238c10cbfc771e89b6cc90.tar.bz2 perlweeklychallenge-club-99c4e905c974e2e92e238c10cbfc771e89b6cc90.zip | |
challenge 330 python, perl, and go solutions
Diffstat (limited to 'challenge-331/ysth/python/ch-2.py')
| -rw-r--r-- | challenge-331/ysth/python/ch-2.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-331/ysth/python/ch-2.py b/challenge-331/ysth/python/ch-2.py new file mode 100644 index 0000000000..6d0f7c80e4 --- /dev/null +++ b/challenge-331/ysth/python/ch-2.py @@ -0,0 +1,15 @@ +import sys +import regex +from itertools import batched + +def buddy_strings(string1: str, string2: str) -> bool: + return True if regex.fullmatch(regex.escape(string1)+'{1<=s<=1}', string2) else False + +def main() -> None: + inputs: list[str] = sys.argv[1:] + + for string1, string2 in batched(inputs, 2): + print(f'{string1:<30}\n{string2:<30}\n -> {"yes" if buddy_strings(string1, string2) else "no"}') + +if __name__ == '__main__': + main() |
