def action_of(origin: str, destination: str) -> int:
    """Finds which action was taken from origin to destination.

    If the states origin and destination are separated by one action, it returns
    the numeric value of the action taken (0 = up, 1 = right, 2 = down, 3 = left).
    It returns -1 if they are separated by more than one action.

    Parameters
    ----------
    origin : str
        A linear representation of a 8-puzzle board, original state
    destination : str
        A linear representation of a 8-puzzle board, the resulting state

    Returns
    -------
    int
        Action taken from origin to destination, or -1 if there isn't a single
        action between the states
    """
    if sum([i == j for (i, j) in zip(list(origin), list(destination))]) == 7:
        pos_orig = origin.find(" ")
        pos_dest = destination.find(" ")

        diff = pos_dest - pos_orig

        if diff == 3:
            return 2
        elif diff == -3:
            return 0
        elif diff == 1:
            return 1
        elif diff == -1:
            return 3
    return -1