def commonprefix(m):
    """Given a list of pathnames, returns the longest common leading component without trailing /"""
    if not m:
        return ""
    m = [p.rstrip("/").split("/") for p in m]

    s1 = min(m)
    s2 = max(m)

    s = s1
    for i, (c1, c2) in enumerate(zip(s1, s2)):
        if c1 != c2:
            s = s1[:i]
            break

    return "/".join(s)