https://leetcode-cn.com/problems/simplify-path/
def simplifyPath(path):
"""
简化路径
输入:"/a//b////c/d//././/.."
输出:"/a/b/c"
"""
s = path.split('/')
res = []
for x in s:
if x:
if x == '..':
if res:
res.pop()
elif x != '.':
res.append(x)
return '/' + '/'.join(res)