/**
 * The function takes a list of landforms, modifies two elements at the specified indices.
 * It then creates a copy of the modified list and returns it.
 *
 * @param landforms A list of landforms.
 * @param index1 The index of the first element to be modified.
 * @param index2 The index of the second element to be modified.
 * @return A copy of the modified list.
 */
fun modifyAndCopyList(landforms: MutableList<String>, index1: Int, index2: Int): MutableList<String> {

    // Modify the elements at the specified indices
    try {
        landforms[index1] = "Modified landform 1"
        landforms[index2] = "Modified landform 2"
    } catch (e: IndexOutOfBoundsException) {
        println("Invalid indices provided.")
        return landforms
    }

    // Create a copy of the modified list
    val copyOfLandforms = landforms.toMutableList()

    return copyOfLandforms
}
/**
 * The function takes a list of landforms, modifies two elements at the specified indices.
 * It then creates a copy of the modified list and returns it.
 *
 * @param landforms A list of landforms.
 * @param index1 The index of the first element to be modified.
 * @param index2 The index of the second element to be modified.
 * @return A copy of the modified list.
 */
fun modifyAndCopyList(landforms: MutableList<String>, index1: Int, index2: Int): MutableList<String> {
/**
 * The function takes a list of landforms, modifies two elements at the specified indices.
 * It then creates a copy of the modified list and returns it.
 *
 * @param landforms A list of landforms.
 * @param index1 The index of the first element to be modified.
 * @param index2 The index of the second element to be modified.
 * @return A copy of the modified list.
 */
fun modifyAndCopyList(landforms: MutableList<String>, index1: Int, index2: Int): MutableList<String> {

    // Modify the elements at the specified indices
    try {
        landforms[index1] = "Modified landform 1"
        landforms[index2] = "Modified landform 2"
    } catch (e: IndexOutOfBoundsException) {
        println("Invalid indices provided.")
        return landforms
    }

    // Create a copy of the modified list
    val copyOfLandforms = landforms.toMutableList()

    return copyOfLandforms
}