def get_shortest_topmost_directories(dirs):
    """Return the shortest topmost directories from the dirs list.

    Args:
        dirs: A list of directories

    Returns:
        The shortest list of parent directories s, such that every directory
        d in dirs can be reached from one (and only one) directory in s.

        For example, given the directories /a, /a/b, /a/b/c, /d/e, /f
        since /a/b and /a/b/c can all be reached from /a, only /a is needed.
        /d/e can only be reached from /d/e and /f from /f, so the resulting
        list is /a, /d/e, and /f.
    """
    if not dirs:
        return []
    sorted_dirs = sorted(dirs)
    current = sorted_dirs.pop(0)
    results = [current]
    current = current + '/'
    while sorted_dirs:
        next = sorted_dirs.pop(0)
        terminated_next = next + '/'
        if not terminated_next.startswith(current):
            current = terminated_next
            results.append(next)
    return results
