import posixpath


def commonPaths(paths):
    """ Returns the common component and the stripped paths

        It expects that directories do always end with a trailing slash and
        paths never begin with a slash (except root).

        :param paths: The list of paths (``[str, str, ...]``)
        :type paths: ``list``

        :return: The common component (always a directory) and the stripped
                 paths (``(str, [str, str, ...])``)
        :rtype: ``tuple``
    """

    common = ''
    if len(paths) > 1 and "/" not in paths:
        common = posixpath.commonprefix(paths)
        if common[-1:] != "/":
            common = common[:common.rfind("/") + 1]

        idx = len(common)
        if idx > 0:
            paths = [path[idx:] or "./" for path in paths]
            common = common[:-1] # chop the trailing slash

    return (common, paths)