```python
"""Prune a file listing with ordered drop and keep rules."""


def prune_listing(listing, rules):
    def segment_fits(pattern, text):
        p = t = mark = 0
        star = -1
        while t < len(text):
            if p < len(pattern) and pattern[p] == "*":
                star = p
                mark = t
                p += 1
            elif p < len(pattern) and pattern[p] == text[t]:
                p += 1
                t += 1
            elif star >= 0:
                p = star + 1
                mark += 1
                t = mark
            else:
                return False
        while p < len(pattern) and pattern[p] == "*":
            p += 1
        return p == len(pattern)

    def split_strict(text, what):
        if not isinstance(text, str) or text == "":
            raise ValueError(f"{what} must be a non-empty string")
        segments = text.split("/")
        if any(segment == "" for segment in segments):
            raise ValueError(f"{what} has an empty segment: {text}")
        return segments

    # Validate every rule and path with split_strict, then keep each
    # path the last matching rule allows; a path no rule matches survives.
    surviving_paths = []
    for path in listing:
        if not isinstance(path, str) or path == "":
            raise ValueError("path must be a non-empty string")
        segments = split_strict(path, "path")

        keep_rule_found = False
        for rule in rules:
            if not isinstance(rule, str):
                raise ValueError("rule must be a non-empty string")
            pattern_segments = split_strict(rule, "pattern")

            match = True
            for i, segment in enumerate(pattern_segments):
                if segment == "*":
                    continue
                elif segment != segments[i]:
                    match = False
                    break

            if match:
                keep_rule_found = True
                surviving_paths.append(path)
                break

    return surviving_paths
```