import re


def camel_or_pascal_case_to_space_delimited(s: str) -> str:
    """Convert `camelCased` or `PascalCased` string to space-delimited.

    Based on https://stackoverflow.com/a/9283563/1557013.

    :param s: string in `camelCase` or `PascalCase`.
    :return: space-delimited string.
    """
    space_delimited = re.sub(r"((?<=[a-z])[A-Z]|(?<!\A)[A-Z](?=[a-z]))", r" \1", s)
    return space_delimited