/**
 * A firefighter is called to put out a fire in a burning house. However, the firefighter is unable to access certain rooms due to obstacles such as closed doors or locked gates. Complete the code by implementing nested loops and conditional statements to determine if the firefighter can successfully extinguish the fire or not.
 *
 * @param house A set of rooms in the burning house. Each room is represented by a character.
 * @return A message indicating whether the firefighter was able to extinguish the fire or not.
 */
fun extinguishFire(house: MutableSet<Char>): String {

    // Checking if the room contains fire or not
    for (room in house) {
        if (room == 'F') {
            // Checking if the virtual key is available to access the room
            for (key in listOf('A', 'B', 'C')) {
                if (key in house) {
                    // Extinguish the fire in the room using a firefighting technique (not implemented)
                    house.remove(room)
                    break
                }
            }
            return "Firefighter cannot access the room as it is locked."
        }
    }

    // Check if all the fires have been extinguished
    if ('F' !in house) {
        return "The fire has been successfully extinguished."
    }

    return "The fire could not be extinguished completely."
}
/**
 * A firefighter is called to put out a fire in a burning house. However, the firefighter is unable to access certain rooms due to obstacles such as closed doors or locked gates. Complete the code by implementing nested loops and conditional statements to determine if the firefighter can successfully extinguish the fire or not.
 *
 * @param house A set of rooms in the burning house. Each room is represented by a character.
 * @return A message indicating whether the firefighter was able to extinguish the fire or not.
 */
fun extinguishFire(house: MutableSet<Char>): String {
/**
 * A firefighter is called to put out a fire in a burning house. However, the firefighter is unable to access certain rooms due to obstacles such as closed doors or locked gates. Complete the code by implementing nested loops and conditional statements to determine if the firefighter can successfully extinguish the fire or not.
 *
 * @param house A set of rooms in the burning house. Each room is represented by a character.
 * @return A message indicating whether the firefighter was able to extinguish the fire or not.
 */
fun extinguishFire(house: MutableSet<Char>): String {

    // Checking if the room contains fire or not
    for (room in house) {
        if (room == 'F') {
            // Checking if the virtual key is available to access the room
            for (key in listOf('A', 'B', 'C')) {
                if (key in house) {
                    // Extinguish the fire in the room using a firefighting technique (not implemented)
                    house.remove(room)
                    break
                }
            }
            return "Firefighter cannot access the room as it is locked."
        }
    }

    // Check if all the fires have been extinguished
    if ('F' !in house) {
        return "The fire has been successfully extinguished."
    }

    return "The fire could not be extinguished completely."
}