/**
 * This exercise requires you to create a function that takes in a list of dance moves as input
 * and performs each dance move on a dancer. Your task is to complete the function so that it
 * executes all the dance moves in the list and returns the final position of the dancer.
 *
 * @param moves A list of dance moves represented by strings.
 * @return The final position of the dancer after performing all the dance moves.
 */
fun danceMoves(moves: List<String>): String {

    var position = intArrayOf(0, 0)

    // Loop through the list of moves
    for (move in moves) {
        // Perform the dance move on the dancer
        when (move) {
            "UP" -> position[1] += 1
            "DOWN" -> position[1] -= 1
            "LEFT" -> position[0] -= 1
            "RIGHT" -> position[0] += 1
            else -> return "UNKNOWN"
        }
    }

    // Return the final position as a string
    return "The dancer's final position is (${position[0]}, ${position[1]})"
}
/**
 * This exercise requires you to create a function that takes in a list of dance moves as input
 * and performs each dance move on a dancer. Your task is to complete the function so that it
 * executes all the dance moves in the list and returns the final position of the dancer.
 *
 * @param moves A list of dance moves represented by strings.
 * @return The final position of the dancer after performing all the dance moves.
 */
fun danceMoves(moves: List<String>): String {
/**
 * This exercise requires you to create a function that takes in a list of dance moves as input
 * and performs each dance move on a dancer. Your task is to complete the function so that it
 * executes all the dance moves in the list and returns the final position of the dancer.
 *
 * @param moves A list of dance moves represented by strings.
 * @return The final position of the dancer after performing all the dance moves.
 */
fun danceMoves(moves: List<String>): String {

    var position = intArrayOf(0, 0)

    // Loop through the list of moves
    for (move in moves) {
        // Perform the dance move on the dancer
        when (move) {
            "UP" -> position[1] += 1
            "DOWN" -> position[1] -= 1
            "LEFT" -> position[0] -= 1
            "RIGHT" -> position[0] += 1
            else -> return "UNKNOWN"
        }
    }

    // Return the final position as a string
    return "The dancer's final position is (${position[0]}, ${position[1]})"
}