/**
 * Given two lists of furniture items, returns a new list containing the common elements between them.
 *
 * @param list1 First list of furniture items
 * @param list2 Second list of furniture items
 * @return A new list containing the common elements between list1 and list2
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {

    val intersection = mutableListOf<String>()

    // Iterate over each item in list1
    for (item in list1) {
        // Check if the item exists in list2 or if any part of the item's name starts with 'sofa'
        if (item in list2 || item.split(" ").any { it.startsWith("sofa") }) {
            // Append the item to the intersection list
            intersection.add(item)
        }
    }

    return intersection
}
/**
 * Given two lists of furniture items, returns a new list containing the common elements between them.
 *
 * @param list1 First list of furniture items
 * @param list2 Second list of furniture items
 * @return A new list containing the common elements between list1 and list2
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {
/**
 * Given two lists of furniture items, returns a new list containing the common elements between them.
 *
 * @param list1 First list of furniture items
 * @param list2 Second list of furniture items
 * @return A new list containing the common elements between list1 and list2
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {

    val intersection = mutableListOf<String>()

    // Iterate over each item in list1
    for (item in list1) {
        // Check if the item exists in list2 or if any part of the item's name starts with 'sofa'
        if (item in list2 || item.split(" ").any { it.startsWith("sofa") }) {
            // Append the item to the intersection list
            intersection.add(item)
        }
    }

    return intersection
}