/**
 * Given a list of items and an index, this function modifies every element in the list by capitalizing it,
 * except for the element at the given index which is completely replaced by a reversed version of itself.
 * The modified list is returned.
 *
 * @param items A list of strings.
 * @param index The index of the element that should be completely reversed.
 * @return The modified list with all elements capitalized, except for the element at the given index which is reversed.
 */
fun modifyListElements(items: List<String>, index: Int): List<String> {

    val modifiedList = mutableListOf<String>()
    for ((i, item) in items.withIndex()) {
        if (i != index) {
            modifiedList.add(item.toUpperCase())
        } else {
            modifiedList.add(item.reversed())
        }
    }
    return modifiedList
}
/**
 * Given a list of items and an index, this function modifies every element in the list by capitalizing it,
 * except for the element at the given index which is completely replaced by a reversed version of itself.
 * The modified list is returned.
 *
 * @param items A list of strings.
 * @param index The index of the element that should be completely reversed.
 * @return The modified list with all elements capitalized, except for the element at the given index which is reversed.
 */
fun modifyListElements(items: List<String>, index: Int): List<String> {
/**
 * Given a list of items and an index, this function modifies every element in the list by capitalizing it,
 * except for the element at the given index which is completely replaced by a reversed version of itself.
 * The modified list is returned.
 *
 * @param items A list of strings.
 * @param index The index of the element that should be completely reversed.
 * @return The modified list with all elements capitalized, except for the element at the given index which is reversed.
 */
fun modifyListElements(items: List<String>, index: Int): List<String> {

    val modifiedList = mutableListOf<String>()
    for ((i, item) in items.withIndex()) {
        if (i != index) {
            modifiedList.add(item.toUpperCase())
        } else {
            modifiedList.add(item.reversed())
        }
    }
    return modifiedList
}