/**
 * Given a tuple and an index, delete the element at that index from the tuple.
 *
 * @param t The tuple from which to delete the element.
 * @param index The index of the element to delete.
 * @return The updated tuple without the deleted element.
 * @throws IndexOutOfBoundsException If the index is out of range.
 *
 * Example:
 * deleteTupleElement(listOf('A', 'B', 'C', 'D'), 2) // ['A', 'B', 'D']
 * deleteTupleElement(listOf('X', 'Y', 'Z'), 0) // ['Y', 'Z']
 */
fun deleteTupleElement(t: List<Char>, index: Int): List<Char> {

    if (index < 0 || index >= t.size) {
        throw IndexOutOfBoundsException("Index out of range")
    }

    // Convert the list to a mutable list
    val tMutableList = t.toMutableList()

    // Delete the element at the given index
    tMutableList.removeAt(index)

    return tMutableList
}
/**
 * Given a tuple and an index, delete the element at that index from the tuple.
 *
 * @param t The tuple from which to delete the element.
 * @param index The index of the element to delete.
 * @return The updated tuple without the deleted element.
 * @throws IndexOutOfBoundsException If the index is out of range.
 *
 * Example:
 * deleteTupleElement(listOf('A', 'B', 'C', 'D'), 2) // ['A', 'B', 'D']
 * deleteTupleElement(listOf('X', 'Y', 'Z'), 0) // ['Y', 'Z']
 */
fun deleteTupleElement(t: List<Char>, index: Int): List<Char> {
/**
 * Given a tuple and an index, delete the element at that index from the tuple.
 *
 * @param t The tuple from which to delete the element.
 * @param index The index of the element to delete.
 * @return The updated tuple without the deleted element.
 * @throws IndexOutOfBoundsException If the index is out of range.
 *
 * Example:
 * deleteTupleElement(listOf('A', 'B', 'C', 'D'), 2) // ['A', 'B', 'D']
 * deleteTupleElement(listOf('X', 'Y', 'Z'), 0) // ['Y', 'Z']
 */
fun deleteTupleElement(t: List<Char>, index: Int): List<Char> {

    if (index < 0 || index >= t.size) {
        throw IndexOutOfBoundsException("Index out of range")
    }

    // Convert the list to a mutable list
    val tMutableList = t.toMutableList()

    // Delete the element at the given index
    tMutableList.removeAt(index)

    return tMutableList
}