/**
 * Given two lists of tuples, 'aList" and 'bList`, create a new list by merging the elements of the tuples based on index.
 * Return the new list.
 *
 * For example:
 * aList = listOf(('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'H', 'I'))
 * bList = listOf(('1', '2', '3'), ('4', '5', '6'), ('7', '8', '9'))
 * mergeTupleLists(aList, bList) should return listOf(('A1', 'B2', 'C3'), ('D4', 'E5', 'F6'), ('G7', 'H8', 'I9'))
 */
fun mergeTupleLists(aList: List<List<String>>, bList: List<List<String>>): List<List<String>> {

    require(aList.size == bList.size) { "Error: Lists must have the same length!" }

    val mergedList = mutableListOf<List<String>>()

    for (i in aList.indices) {
        val mergedTuple = mutableListOf<String>()
        for (j in aList[i].indices) {
            mergedTuple.add(aList[i][j] + bList[i][j])
        }
        mergedList.add(mergedTuple)
    }

    return mergedList
}
/**
 * Given two lists of tuples, 'aList" and 'bList`, create a new list by merging the elements of the tuples based on index.
 * Return the new list.
 *
 * For example:
 * aList = listOf(('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'H', 'I'))
 * bList = listOf(('1', '2', '3'), ('4', '5', '6'), ('7', '8', '9'))
 * mergeTupleLists(aList, bList) should return listOf(('A1', 'B2', 'C3'), ('D4', 'E5', 'F6'), ('G7', 'H8', 'I9'))
 */
fun mergeTupleLists(aList: List<List<String>>, bList: List<List<String>>): List<List<String>> {
/**
 * Given two lists of tuples, 'aList" and 'bList`, create a new list by merging the elements of the tuples based on index.
 * Return the new list.
 *
 * For example:
 * aList = listOf(('A', 'B', 'C'), ('D', 'E', 'F'), ('G', 'H', 'I'))
 * bList = listOf(('1', '2', '3'), ('4', '5', '6'), ('7', '8', '9'))
 * mergeTupleLists(aList, bList) should return listOf(('A1', 'B2', 'C3'), ('D4', 'E5', 'F6'), ('G7', 'H8', 'I9'))
 */
fun mergeTupleLists(aList: List<List<String>>, bList: List<List<String>>): List<List<String>> {

    require(aList.size == bList.size) { "Error: Lists must have the same length!" }

    val mergedList = mutableListOf<List<String>>()

    for (i in aList.indices) {
        val mergedTuple = mutableListOf<String>()
        for (j in aList[i].indices) {
            mergedTuple.add(aList[i][j] + bList[i][j])
        }
        mergedList.add(mergedTuple)
    }

    return mergedList
}