/**
 * Given two lists of furniture items in rooms, find the common items in both rooms.
 *
 * @param room1 A list of furniture items in room 1.
 * @param room2 A list of furniture items in room 2.
 * @return A list of common furniture items present in both rooms.
 *
 * Example:
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("sofa", "cupboard", "bookshelf")) // Output: ["sofa"]
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("cupboard", "bookshelf")) // Output: []
 */
fun findCommonElements(room1: List<String>, room2: List<String>): List<String> {

    val commonItems = mutableListOf<String>()

    // Iterate over each furniture item in room1
    for (item1 in room1) {
        // Iterate over each furniture item in room2
        for (item2 in room2) {
            // If the furniture item in room1 matches with the furniture item in room2
            if (item1 == item2) {
                // Add the common item to the commonItems list
                commonItems.add(item1)
            }
        }
    }

    return commonItems
}
/**
 * Given two lists of furniture items in rooms, find the common items in both rooms.
 *
 * @param room1 A list of furniture items in room 1.
 * @param room2 A list of furniture items in room 2.
 * @return A list of common furniture items present in both rooms.
 *
 * Example:
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("sofa", "cupboard", "bookshelf")) // Output: ["sofa"]
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("cupboard", "bookshelf")) // Output: []
 */
fun findCommonElements(room1: List<String>, room2: List<String>): List<String> {
/**
 * Given two lists of furniture items in rooms, find the common items in both rooms.
 *
 * @param room1 A list of furniture items in room 1.
 * @param room2 A list of furniture items in room 2.
 * @return A list of common furniture items present in both rooms.
 *
 * Example:
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("sofa", "cupboard", "bookshelf")) // Output: ["sofa"]
 * findCommonElements(listOf("chair", "table", "sofa"), listOf("cupboard", "bookshelf")) // Output: []
 */
fun findCommonElements(room1: List<String>, room2: List<String>): List<String> {

    val commonItems = mutableListOf<String>()

    // Iterate over each furniture item in room1
    for (item1 in room1) {
        // Iterate over each furniture item in room2
        for (item2 in room2) {
            // If the furniture item in room1 matches with the furniture item in room2
            if (item1 == item2) {
                // Add the common item to the commonItems list
                commonItems.add(item1)
            }
        }
    }

    return commonItems
}