/**
 * Find the common elements between two lists of items.
 *
 * @param items1 The first list of items.
 * @param items2 The second list of items.
 * @return A list containing the common elements found in both lists.
 *
 * Example:
 * val items1 = listOf("chair", "table", "lamp", "rug")
 * val items2 = listOf("sofa", "chair", "rug", "curtains")
 * findCommonElements(items1, items2) // Output: ["chair", "rug"]
 */
fun findCommonElements(items1: List<String>, items2: List<String>): List<String> {

    val commonItems = mutableListOf<String>()

    for (item1 in items1) {
        for (item2 in items2) {
            if (item1 == item2 && item1 !in commonItems) {
                commonItems.add(item1)
            }
        }
    }

    return commonItems
}
/**
 * Find the common elements between two lists of items.
 *
 * @param items1 The first list of items.
 * @param items2 The second list of items.
 * @return A list containing the common elements found in both lists.
 *
 * Example:
 * val items1 = listOf("chair", "table", "lamp", "rug")
 * val items2 = listOf("sofa", "chair", "rug", "curtains")
 * findCommonElements(items1, items2) // Output: ["chair", "rug"]
 */
fun findCommonElements(items1: List<String>, items2: List<String>): List<String> {
/**
 * Find the common elements between two lists of items.
 *
 * @param items1 The first list of items.
 * @param items2 The second list of items.
 * @return A list containing the common elements found in both lists.
 *
 * Example:
 * val items1 = listOf("chair", "table", "lamp", "rug")
 * val items2 = listOf("sofa", "chair", "rug", "curtains")
 * findCommonElements(items1, items2) // Output: ["chair", "rug"]
 */
fun findCommonElements(items1: List<String>, items2: List<String>): List<String> {

    val commonItems = mutableListOf<String>()

    for (item1 in items1) {
        for (item2 in items2) {
            if (item1 == item2 && item1 !in commonItems) {
                commonItems.add(item1)
            }
        }
    }

    return commonItems
}