/**
 * Given a list of elements, an index, and a new element, this function modifies the element at the given index
 * and appends the new element to the end of the list.
 *
 * @param elements List of elements
 * @param index Index of the element to be modified
 * @param newElement New element to be appended to the list
 * @return List with the modified element and the new element appended at the end
 */
fun modifyAndAppend(elements: MutableList<String>, index: Int, newElement: String): List<String> {

    // Modify the element at the given index
    elements[index] = elements[index] + " (Modified)"

    // Append the new element to the end of the list
    elements.add(newElement)

    return elements
}
/**
 * Given a list of elements, an index, and a new element, this function modifies the element at the given index
 * and appends the new element to the end of the list.
 *
 * @param elements List of elements
 * @param index Index of the element to be modified
 * @param newElement New element to be appended to the list
 * @return List with the modified element and the new element appended at the end
 */
fun modifyAndAppend(elements: MutableList<String>, index: Int, newElement: String): List<String> {
/**
 * Given a list of elements, an index, and a new element, this function modifies the element at the given index
 * and appends the new element to the end of the list.
 *
 * @param elements List of elements
 * @param index Index of the element to be modified
 * @param newElement New element to be appended to the list
 * @return List with the modified element and the new element appended at the end
 */
fun modifyAndAppend(elements: MutableList<String>, index: Int, newElement: String): List<String> {

    // Modify the element at the given index
    elements[index] = elements[index] + " (Modified)"

    // Append the new element to the end of the list
    elements.add(newElement)

    return elements
}