diff --git a/TaskC46/C46.py b/TaskC46/C46.py new file mode 100644 index 0000000..a2757b5 --- /dev/null +++ b/TaskC46/C46.py @@ -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("") diff --git a/TaskC46/Makefile b/TaskC46/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/TaskC46/run b/TaskC46/run new file mode 100755 index 0000000..76d5f30 --- /dev/null +++ b/TaskC46/run @@ -0,0 +1,2 @@ +#!/bin/bash +python3 TaskC46/C46.py "$@" \ No newline at end of file