/**
 * Given two arrays, concatenate them into a single string and slice a subarray from the resulting string.
 *
 * @param array1 First array to concatenate
 * @param array2 Second array to concatenate
 * @param index1 Starting index of the subarray to slice
 * @param index2 Ending index of the subarray to slice
 * @return The sliced subarray as a string
 *
 * Example:
 * concatenateAndSliceList(listOf('a', 'b', 'c'), listOf('d', 'e', 'f'), 2, 5) // Returns 'ce'
 */
fun concatenateAndSliceList(array1: List<Char>, array2: List<Char>, index1: Int, index2: Int): String {

    // Concatenate the two arrays into a single string
    val concatenatedStr = (array1 + array2).joinToString("")

    // Slice the subarray from the concatenated string
    val slicedStr = concatenatedStr.substring(index1, index2)

    return slicedStr
}
/**
 * Given two arrays, concatenate them into a single string and slice a subarray from the resulting string.
 *
 * @param array1 First array to concatenate
 * @param array2 Second array to concatenate
 * @param index1 Starting index of the subarray to slice
 * @param index2 Ending index of the subarray to slice
 * @return The sliced subarray as a string
 *
 * Example:
 * concatenateAndSliceList(listOf('a', 'b', 'c'), listOf('d', 'e', 'f'), 2, 5) // Returns 'ce'
 */
fun concatenateAndSliceList(array1: List<Char>, array2: List<Char>, index1: Int, index2: Int): String {
/**
 * Given two arrays, concatenate them into a single string and slice a subarray from the resulting string.
 *
 * @param array1 First array to concatenate
 * @param array2 Second array to concatenate
 * @param index1 Starting index of the subarray to slice
 * @param index2 Ending index of the subarray to slice
 * @return The sliced subarray as a string
 *
 * Example:
 * concatenateAndSliceList(listOf('a', 'b', 'c'), listOf('d', 'e', 'f'), 2, 5) // Returns 'ce'
 */
fun concatenateAndSliceList(array1: List<Char>, array2: List<Char>, index1: Int, index2: Int): String {

    // Concatenate the two arrays into a single string
    val concatenatedStr = (array1 + array2).joinToString("")

    // Slice the subarray from the concatenated string
    val slicedStr = concatenatedStr.substring(index1, index2)

    return slicedStr
}