/**
 * This exercise requires you to create a function that takes in the current position of a dancer on a number line and a list of steps they need to take.
 * The function should calculate the final position of the dancer after taking all the steps, where each step can be "L" for left or "R" for right.
 *
 * @param dancerPosition The current position of the dancer on the number line.
 * @param steps A list of strings representing the steps the dancer needs to take. Each step can be "L" for left or "R" for right.
 * @return The final position of the dancer on the number line after taking all the steps.
 *
 * Example:
 * dancerMoves(0, listOf("R", "R", "L", "R", "L")) -> 1
 */
fun dancerMoves(dancerPosition: Int, steps: List<String>): Int {

    var finalPosition = dancerPosition

    for (step in steps) {
        if (step == "R") {
            finalPosition++
        } else if (step == "L") {
            finalPosition--
        }
    }

    return finalPosition
}
/**
 * This exercise requires you to create a function that takes in the current position of a dancer on a number line and a list of steps they need to take.
 * The function should calculate the final position of the dancer after taking all the steps, where each step can be "L" for left or "R" for right.
 *
 * @param dancerPosition The current position of the dancer on the number line.
 * @param steps A list of strings representing the steps the dancer needs to take. Each step can be "L" for left or "R" for right.
 * @return The final position of the dancer on the number line after taking all the steps.
 *
 * Example:
 * dancerMoves(0, listOf("R", "R", "L", "R", "L")) -> 1
 */
fun dancerMoves(dancerPosition: Int, steps: List<String>): Int {
/**
 * This exercise requires you to create a function that takes in the current position of a dancer on a number line and a list of steps they need to take.
 * The function should calculate the final position of the dancer after taking all the steps, where each step can be "L" for left or "R" for right.
 *
 * @param dancerPosition The current position of the dancer on the number line.
 * @param steps A list of strings representing the steps the dancer needs to take. Each step can be "L" for left or "R" for right.
 * @return The final position of the dancer on the number line after taking all the steps.
 *
 * Example:
 * dancerMoves(0, listOf("R", "R", "L", "R", "L")) -> 1
 */
fun dancerMoves(dancerPosition: Int, steps: List<String>): Int {

    var finalPosition = dancerPosition

    for (step in steps) {
        if (step == "R") {
            finalPosition++
        } else if (step == "L") {
            finalPosition--
        }
    }

    return finalPosition
}