/**
 * In this exercise, you need to modify the element of a dancer's move list using indexing.
 *
 * @param dancer A list containing a dancer's move list.
 * @param index The index position of the move to be modified.
 * @return The modified dancer's move list.
 */
fun modifyDancer(dancer: MutableList<String>, index: Int): MutableList<String> {

    // Check if the index is valid
    if (index > dancer.size - 1) {
        println("Invalid index!")
        return dancer
    }

    // Modify the move at the given index
    when (dancer[index]) {
        "spin" -> dancer[index] = "jump"
        "jump" -> dancer[index] = "kick"
        "kick" -> dancer[index] = "twirl"
        "twirl" -> dancer[index] = "slide"
        "slide" -> dancer[index] = "spin"
        else -> println("Unknown move!")
    }

    // Return the modified dancer's move list
    return dancer
}
/**
 * In this exercise, you need to modify the element of a dancer's move list using indexing.
 *
 * @param dancer A list containing a dancer's move list.
 * @param index The index position of the move to be modified.
 * @return The modified dancer's move list.
 */
fun modifyDancer(dancer: MutableList<String>, index: Int): MutableList<String> {
/**
 * In this exercise, you need to modify the element of a dancer's move list using indexing.
 *
 * @param dancer A list containing a dancer's move list.
 * @param index The index position of the move to be modified.
 * @return The modified dancer's move list.
 */
fun modifyDancer(dancer: MutableList<String>, index: Int): MutableList<String> {

    // Check if the index is valid
    if (index > dancer.size - 1) {
        println("Invalid index!")
        return dancer
    }

    // Modify the move at the given index
    when (dancer[index]) {
        "spin" -> dancer[index] = "jump"
        "jump" -> dancer[index] = "kick"
        "kick" -> dancer[index] = "twirl"
        "twirl" -> dancer[index] = "slide"
        "slide" -> dancer[index] = "spin"
        else -> println("Unknown move!")
    }

    // Return the modified dancer's move list
    return dancer
}