def remove_dot_segments(path: str) -> str:
    """
    Remove the dot segments of a given path

    The implementation of this method was inspired
    by RFC 3986, section 5.2.4, but uses another,
    much easier and yet probably equivalent algorithm.

    :param path: any path that may contain dot segments
    :return: path without dot segments
    """

    out = []

    for segment in path.split("/"):
        if segment == "" or segment == ".":
            pass
        elif segment == "..":
            if len(out) > 0:
                out.pop()
        else:
            out.append(segment)

    return "/" + "/".join(out)