19 lines
666 B
Python
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>")
|