here is my python solution. The algorithm is simple using stack

```
def simplifyPath(self, path):
z = path.split("/")
z = filter(lambda x: x != "" and x != ".",z)
s = list();
for x in z:
if(x != ".."):
s.append(x)
elif s:
s.pop()
result = "/".join(s)
return "/"+result
```