djfz-2020-s450026/TaskC46/C46.py
2020-11-22 17:55:11 +01:00

19 lines
666 B
Python

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>")