/**
 * This exercise requires the user to write a function that replaces the specified number
 * of light bulbs in a given room. The function should execute a block of code multiple times,
 * changing individual elements to achieve the desired result.
 *
 * @param room The name of the room where the light bulbs are located.
 * @param numBulbs The number of light bulbs to be replaced.
 * @return The updated string indicating the status of the light bulbs in the room.
 */
fun replaceLightbulbs(room: String, numBulbs: Int): String {

    var updatedRoom = room
    repeat(numBulbs) {
        // Complete the line below to replace the faulty light bulb in the room
        updatedRoom = updatedRoom.replaceFirst('B', 'R', ignoreCase = false) // 'B' represents a faulty bulb, 'R' represents a new replacement bulb
    }
    return updatedRoom
}
/**
 * This exercise requires the user to write a function that replaces the specified number
 * of light bulbs in a given room. The function should execute a block of code multiple times,
 * changing individual elements to achieve the desired result.
 *
 * @param room The name of the room where the light bulbs are located.
 * @param numBulbs The number of light bulbs to be replaced.
 * @return The updated string indicating the status of the light bulbs in the room.
 */
fun replaceLightbulbs(room: String, numBulbs: Int): String {
/**
 * This exercise requires the user to write a function that replaces the specified number
 * of light bulbs in a given room. The function should execute a block of code multiple times,
 * changing individual elements to achieve the desired result.
 *
 * @param room The name of the room where the light bulbs are located.
 * @param numBulbs The number of light bulbs to be replaced.
 * @return The updated string indicating the status of the light bulbs in the room.
 */
fun replaceLightbulbs(room: String, numBulbs: Int): String {

    var updatedRoom = room
    repeat(numBulbs) {
        // Complete the line below to replace the faulty light bulb in the room
        updatedRoom = updatedRoom.replaceFirst('B', 'R', ignoreCase = false) // 'B' represents a faulty bulb, 'R' represents a new replacement bulb
    }
    return updatedRoom
}