/**
 * Given a list of existing clothing items and a list of new clothing items,
 * this function appends the new items to the existing ones if they are
 * not already present in the collection. The function returns the updated
 * collection of clothing items as a list.
 *
 * @param existingItems A list of strings representing the existing clothing items.
 * @param newItems A list of strings representing the new clothing items.
 * @return A list containing the updated collection of clothing items.
 *
 * Example:
 * val existingItems = mutableListOf("shirt", "jeans", "sweater")
 * val newItems = listOf("jeans", "t-shirt", "jacket")
 * updateCollection(existingItems, newItems)  // should return ["shirt", "jeans", "sweater", "t-shirt", "jacket"]
 */
fun updateCollection(existingItems: MutableList<String>, newItems: List<String>): List<String> {

    for (item in newItems) {
        if (item !in existingItems) {
            existingItems.add(item)
        }
    }
    return existingItems
}
/**
 * Given a list of existing clothing items and a list of new clothing items,
 * this function appends the new items to the existing ones if they are
 * not already present in the collection. The function returns the updated
 * collection of clothing items as a list.
 *
 * @param existingItems A list of strings representing the existing clothing items.
 * @param newItems A list of strings representing the new clothing items.
 * @return A list containing the updated collection of clothing items.
 *
 * Example:
 * val existingItems = mutableListOf("shirt", "jeans", "sweater")
 * val newItems = listOf("jeans", "t-shirt", "jacket")
 * updateCollection(existingItems, newItems)  // should return ["shirt", "jeans", "sweater", "t-shirt", "jacket"]
 */
fun updateCollection(existingItems: MutableList<String>, newItems: List<String>): List<String> {
/**
 * Given a list of existing clothing items and a list of new clothing items,
 * this function appends the new items to the existing ones if they are
 * not already present in the collection. The function returns the updated
 * collection of clothing items as a list.
 *
 * @param existingItems A list of strings representing the existing clothing items.
 * @param newItems A list of strings representing the new clothing items.
 * @return A list containing the updated collection of clothing items.
 *
 * Example:
 * val existingItems = mutableListOf("shirt", "jeans", "sweater")
 * val newItems = listOf("jeans", "t-shirt", "jacket")
 * updateCollection(existingItems, newItems)  // should return ["shirt", "jeans", "sweater", "t-shirt", "jacket"]
 */
fun updateCollection(existingItems: MutableList<String>, newItems: List<String>): List<String> {

    for (item in newItems) {
        if (item !in existingItems) {
            existingItems.add(item)
        }
    }
    return existingItems
}