/**
 * Given a list of clothing items, the index of an item to modify, and new elements,
 * modify the specified item in the list by replacing the selected index with the new elements.
 *
 * @param clothingItems a list of clothing items (strings)
 * @param index index of the item to modify (integer)
 * @param newElements new elements to replace the selected index (list)
 * @return modifiedClothingItems the modified list with the selected item updated
 */
fun modifyClothingItem(clothingItems: MutableList<String>, index: Int, newElements: List<String>): List<String> {

    // Check if the index is within the range of the list
    if (index < 0 || index >= clothingItems.size) {
        return listOf("Invalid index")
    }

    // Modify the specified item by replacing the selected index with the new elements
    clothingItems[index] = newElements.joinToString(separator = " ")

    return clothingItems
}
/**
 * Given a list of clothing items, the index of an item to modify, and new elements,
 * modify the specified item in the list by replacing the selected index with the new elements.
 *
 * @param clothingItems a list of clothing items (strings)
 * @param index index of the item to modify (integer)
 * @param newElements new elements to replace the selected index (list)
 * @return modifiedClothingItems the modified list with the selected item updated
 */
fun modifyClothingItem(clothingItems: MutableList<String>, index: Int, newElements: List<String>): List<String> {
/**
 * Given a list of clothing items, the index of an item to modify, and new elements,
 * modify the specified item in the list by replacing the selected index with the new elements.
 *
 * @param clothingItems a list of clothing items (strings)
 * @param index index of the item to modify (integer)
 * @param newElements new elements to replace the selected index (list)
 * @return modifiedClothingItems the modified list with the selected item updated
 */
fun modifyClothingItem(clothingItems: MutableList<String>, index: Int, newElements: List<String>): List<String> {

    // Check if the index is within the range of the list
    if (index < 0 || index >= clothingItems.size) {
        return listOf("Invalid index")
    }

    // Modify the specified item by replacing the selected index with the new elements
    clothingItems[index] = newElements.joinToString(separator = " ")

    return clothingItems
}