from typing import List


def get_whitespace_operations(from_sequence: str, to_sequence: str) -> List[int]:
    """

    Get the repair sequence that turns from_sequence into to_sequence (after applying the repair_whitespace function)

    :param from_sequence: sequence that the returned repair tokens should be applied to to get the to_sequence
    :param to_sequence: sequence that should result from applying the whitespace operations to the from_sequence
    :return: list of repair tokens
    """
    assert from_sequence.replace(" ", "") == to_sequence.replace(" ", ""), \
        f"make sure from_sequence and to_sequence only differ in whitespaces:\n{from_sequence}\n{to_sequence}"

    from_sequence_ptr = 0
    to_sequence_ptr = 0

    repair_tokens = []

    while from_sequence_ptr < len(from_sequence):  # and to_sequence_ptr < len(to_sequence):
        from_char = from_sequence[from_sequence_ptr]
        to_char = to_sequence[to_sequence_ptr] if to_sequence_ptr < len(to_sequence) else ""

        if from_char == to_char:
            repair_tokens.append(0)
            from_sequence_ptr += 1
            to_sequence_ptr += 1

        elif to_char == " ":
            repair_tokens.append(1)
            from_sequence_ptr += 1
            to_sequence_ptr += 2

        elif from_char == " ":
            repair_tokens.append(2)
            from_sequence_ptr += 1

        else:
            raise ValueError("should not happen")

    assert len(repair_tokens) == len(from_sequence), \
        f"{''.join(str(r) for r in repair_tokens)}\n'{from_sequence}'\n'{to_sequence}'"

    return repair_tokens