def create_surrogate_string(instr: str):
    """
    Preserve newlines and replace all other characters with spaces

    :return whitespace string with same length as instr and with the same line breaks
    """
    return ''.join(['\n' if e == '\n' else ' ' for e in instr])