diff options
| author | rir <rirans@comcast.net> | 2024-03-16 20:07:25 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-16 20:07:25 -0400 |
| commit | ff5e8ece15a2384fbfb530710f10aa485017d4a5 (patch) | |
| tree | 6fe268d9ceb2b25a2951ea984c077450feb2efae /challenge-012/zapwai/python/ch-2.py | |
| parent | 60f1003122fbada697317d943c238593f86db579 (diff) | |
| parent | 62e7fc3bb85a74125663f4fbd0a5911f6f30c81f (diff) | |
| download | perlweeklychallenge-club-ff5e8ece15a2384fbfb530710f10aa485017d4a5.tar.gz perlweeklychallenge-club-ff5e8ece15a2384fbfb530710f10aa485017d4a5.tar.bz2 perlweeklychallenge-club-ff5e8ece15a2384fbfb530710f10aa485017d4a5.zip | |
Merge branch 'manwar:master' into work
Diffstat (limited to 'challenge-012/zapwai/python/ch-2.py')
| -rw-r--r-- | challenge-012/zapwai/python/ch-2.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-012/zapwai/python/ch-2.py b/challenge-012/zapwai/python/ch-2.py new file mode 100644 index 0000000000..14580e9a23 --- /dev/null +++ b/challenge-012/zapwai/python/ch-2.py @@ -0,0 +1,19 @@ +import re +input = """/a/b/c/d +/a/b/cd +/a/b/cc +/a/b/c/d/e""" + +def proc(input): + line = input.split() + prefix = line[0] + cnt = 1 + while cnt > 0: + cnt = 0 + prefix = prefix[0:prefix.rindex("/")] + for i in range(len(line)): + if not re.search("^"+prefix+"\/", line[i]): + cnt += 1 + return prefix + +print(proc(input)) |
