Zadanie 46

This commit is contained in:
s450026 2020-11-22 17:55:11 +01:00
parent fa142f084c
commit d85b2eaa7b
3 changed files with 20 additions and 0 deletions

18
TaskC46/C46.py Normal file
View File

@ -0,0 +1,18 @@
import re
import sys
def line_contains_correct_path(line):
if re.findall("^\/(\w+\/)+([\w|\.|\-]*)", line, re.DOTALL) and len(
re.search("^\/(\w+\/)+([\w|\.|\-]*)", line, re.DOTALL)[0]) > 1:
return re.findall("^\/(\w+\/)+([\w|\.|\-]*)", line, re.DOTALL)[0][1]
elif re.findall("^(\w:\\\)(\w+\\\)*([\w|\.|\-]*)$", line) and len(
re.findall("^(\w:\\\)(\w+\\\)*([\w|\.|\-]*)$", line)[0]) > 2:
return re.findall("^(\w:\\\)(\w+\\\)*([\w|\.|\-]*)$", line)[0][2]
for line in sys.stdin:
if line_contains_correct_path(line):
print(line_contains_correct_path(line).rstrip('\n'))
else:
print("<NONE>")

0
TaskC46/Makefile Normal file
View File

2
TaskC46/run Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
python3 TaskC46/C46.py "$@"