/**
 * Given a dancer tuple, an index and a replacement value, delete the element at the given index and insert the replacement value at that position.
 *
 * @param dancer A tuple representing the dancer.
 * @param index The index of the element to be deleted and replaced.
 * @param replacement The value to replace the deleted element.
 * @return The updated dancer tuple with the element deleted and replaced.
 *
 * Example:
 * deleteNReplace(listOf("Michael", "Jackson", "Moonwalk"), 1, "Thriller")
 * Output: listOf("Michael", "Thriller", "Moonwalk")
 */
fun deleteNReplace(dancer: List<String>, index: Int, replacement: String): List<String> {

    val updatedDancer = dancer.toMutableList()
    updatedDancer.removeAt(index)
    updatedDancer.add(index, replacement)
    return updatedDancer
}
/**
 * Given a dancer tuple, an index and a replacement value, delete the element at the given index and insert the replacement value at that position.
 *
 * @param dancer A tuple representing the dancer.
 * @param index The index of the element to be deleted and replaced.
 * @param replacement The value to replace the deleted element.
 * @return The updated dancer tuple with the element deleted and replaced.
 *
 * Example:
 * deleteNReplace(listOf("Michael", "Jackson", "Moonwalk"), 1, "Thriller")
 * Output: listOf("Michael", "Thriller", "Moonwalk")
 */
fun deleteNReplace(dancer: List<String>, index: Int, replacement: String): List<String> {
/**
 * Given a dancer tuple, an index and a replacement value, delete the element at the given index and insert the replacement value at that position.
 *
 * @param dancer A tuple representing the dancer.
 * @param index The index of the element to be deleted and replaced.
 * @param replacement The value to replace the deleted element.
 * @return The updated dancer tuple with the element deleted and replaced.
 *
 * Example:
 * deleteNReplace(listOf("Michael", "Jackson", "Moonwalk"), 1, "Thriller")
 * Output: listOf("Michael", "Thriller", "Moonwalk")
 */
fun deleteNReplace(dancer: List<String>, index: Int, replacement: String): List<String> {

    val updatedDancer = dancer.toMutableList()
    updatedDancer.removeAt(index)
    updatedDancer.add(index, replacement)
    return updatedDancer
}