class Solution(object):
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
paths=path.split('/')
outpath=[]
for p in paths:
if p=='' or p=='.':
continue
if p=='..':
if len(outpath)>0:
del outpath[-1]
continue
outpath.append(p)
return '/'+'/'.join(outpath)