/**
 * This function takes in a fire map represented as a list of lists.
 * Each list represents a row in the map and contains either 'F' for fire or 'E' for empty space.
 *
 * Your task is to use nested loops and the step parameter to extinguish the fire.
 * The function should return the modified fire map with all fire cells replaced by empty spaces ('E').
 * Assume that the fire spreads vertically and horizontally but not diagonally.
 */
fun extinguishFire(fireMap: List<MutableList<String>>): List<MutableList<String>> {

    // Create a set to store the indices of fire cells
    val fireCells = mutableSetOf<Pair<Int, Int>>()

    // Find the indices of all fire cells
    for (row in fireMap.indices) {
        for (col in fireMap[row].indices) {
            if (fireMap[row][col] == "F") {
                fireCells.add(Pair(row, col))
            }
        }
    }

    // Extinguish the fire by replacing fire cells with empty spaces
    for ((row, col) in fireCells) {
        fireMap[row][col] = "E"
    }

    return fireMap
}
/**
 * This function takes in a fire map represented as a list of lists.
 * Each list represents a row in the map and contains either 'F' for fire or 'E' for empty space.
 *
 * Your task is to use nested loops and the step parameter to extinguish the fire.
 * The function should return the modified fire map with all fire cells replaced by empty spaces ('E').
 * Assume that the fire spreads vertically and horizontally but not diagonally.
 */
fun extinguishFire(fireMap: List<MutableList<String>>): List<MutableList<String>> {
/**
 * This function takes in a fire map represented as a list of lists.
 * Each list represents a row in the map and contains either 'F' for fire or 'E' for empty space.
 *
 * Your task is to use nested loops and the step parameter to extinguish the fire.
 * The function should return the modified fire map with all fire cells replaced by empty spaces ('E').
 * Assume that the fire spreads vertically and horizontally but not diagonally.
 */
fun extinguishFire(fireMap: List<MutableList<String>>): List<MutableList<String>> {

    // Create a set to store the indices of fire cells
    val fireCells = mutableSetOf<Pair<Int, Int>>()

    // Find the indices of all fire cells
    for (row in fireMap.indices) {
        for (col in fireMap[row].indices) {
            if (fireMap[row][col] == "F") {
                fireCells.add(Pair(row, col))
            }
        }
    }

    // Extinguish the fire by replacing fire cells with empty spaces
    for ((row, col) in fireCells) {
        fireMap[row][col] = "E"
    }

    return fireMap
}