

def simplify_path(path):
    stack = []
    for folder in path.split('/'):
        if folder:
            if folder == '..':
                if stack:
                    stack.pop()
            elif folder != '.':
                stack.append(folder)

    return '/' + '/'.join(stack)