/**
 * Given two lists, concatenates them and returns the sliced portion based on the provided index.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @param index The index at which to slice the concatenated list.
 * @return The sliced portion of the concatenated list starting from the given index.
 *
 * Example:
 * concatenateAndSliceList(listOf(1, 2, 3), listOf(4, 5, 6), 2) returns [3, 4, 5, 6]
 * concatenateAndSliceList(listOf("a", "b", "c"), listOf("d", "e", "f", "g"), 1) returns ["b", "c", "d", "e", "f", "g"]
 */
fun concatenateAndSliceList(list1: List<Any>, list2: List<Any>, index: Int): List<Any> {

    // Concatenate the two lists
    val combinedList = list1 + list2

    // Slice the concatenated list based on the provided index
    val slicedList = combinedList.subList(index, combinedList.size)

    return slicedList
}
/**
 * Given two lists, concatenates them and returns the sliced portion based on the provided index.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @param index The index at which to slice the concatenated list.
 * @return The sliced portion of the concatenated list starting from the given index.
 *
 * Example:
 * concatenateAndSliceList(listOf(1, 2, 3), listOf(4, 5, 6), 2) returns [3, 4, 5, 6]
 * concatenateAndSliceList(listOf("a", "b", "c"), listOf("d", "e", "f", "g"), 1) returns ["b", "c", "d", "e", "f", "g"]
 */
fun concatenateAndSliceList(list1: List<Any>, list2: List<Any>, index: Int): List<Any> {
/**
 * Given two lists, concatenates them and returns the sliced portion based on the provided index.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @param index The index at which to slice the concatenated list.
 * @return The sliced portion of the concatenated list starting from the given index.
 *
 * Example:
 * concatenateAndSliceList(listOf(1, 2, 3), listOf(4, 5, 6), 2) returns [3, 4, 5, 6]
 * concatenateAndSliceList(listOf("a", "b", "c"), listOf("d", "e", "f", "g"), 1) returns ["b", "c", "d", "e", "f", "g"]
 */
fun concatenateAndSliceList(list1: List<Any>, list2: List<Any>, index: Int): List<Any> {

    // Concatenate the two lists
    val combinedList = list1 + list2

    // Slice the concatenated list based on the provided index
    val slicedList = combinedList.subList(index, combinedList.size)

    return slicedList
}