(path)
return '/' + '/'.join(stack)
:type path: str
    :rtype: str
:type path: str
    :rtype: str
: type path : str : rtype : str
def simplify_path(path):
    """
    :type path: str
    :rtype: str
    """
    skip = set(['..', '.', ''])
    stack = []
    paths = path.split('/')
    for tok in paths:
        if tok == '..':
            if stack:
                stack.pop()
        elif tok not in skip:
            stack.append(tok)
    return '/' + '/'.join(stack)
def simplify_path ( path ) : skip = set ( [ '..' , '.' , '' ] ) stack = [ ] paths = path . split ( '/' ) for tok in paths : if tok == '..' : if stack : stack . pop ( ) elif tok not in skip : stack . append ( tok ) return '/' + '/' . join ( stack )