def get_rails(message: str, rails: int) -> list:
    """
    Generate encoded rails

    :param message: string to encode
    :param rails: number of rails
    :return: encoded rails (list)
    """
    encoded: list = [([''] * len(message.replace(' ', ''))) for r in range(rails)]
    row, col, down = 0, 0, True

    for char in message.replace(' ', ''):
        encoded[row][col] = char

        if row == rails - 1 and down:
            down = False

        if row == 0 and not down:
            down = True

        if row < rails and down:
            row += 1

        if row > 0 and not down:
            row -= 1

        col += 1

    return encoded