题目:
题解:
class Solution:
def simplifyPath(self, path: str) -> str:
names = path.split("/")
stack = list()
for name in names:
if name == "..":
if stack:
stack.pop()
elif name and name != ".":
stack.append(name)
return "/" + "/".join(stack)