/**
 * This exercise requires you to copy a list of journalists and modify the title of an element using list methods.
 *
 * @param journalists a list of journalist names
 * @param index the index of the journalist whose title needs to be modified
 * @param newTitle the new title to set for the journalist
 * @return The modified list of journalists with the updated title for the specified index.
 */
fun copyAndModifyElements(journalists: List<String>, index: Int, newTitle: String): List<String> {

    // Copy the list of journalists
    val copiedJournalists = journalists.toMutableList()

    // Check if the index is within the boundaries of the list
    if (index >= 0 && index < copiedJournalists.size) {
        // Modify the title of the journalist at the specified index
        copiedJournalists[index] = newTitle
    }

    return copiedJournalists
}
/**
 * This exercise requires you to copy a list of journalists and modify the title of an element using list methods.
 *
 * @param journalists a list of journalist names
 * @param index the index of the journalist whose title needs to be modified
 * @param newTitle the new title to set for the journalist
 * @return The modified list of journalists with the updated title for the specified index.
 */
fun copyAndModifyElements(journalists: List<String>, index: Int, newTitle: String): List<String> {
/**
 * This exercise requires you to copy a list of journalists and modify the title of an element using list methods.
 *
 * @param journalists a list of journalist names
 * @param index the index of the journalist whose title needs to be modified
 * @param newTitle the new title to set for the journalist
 * @return The modified list of journalists with the updated title for the specified index.
 */
fun copyAndModifyElements(journalists: List<String>, index: Int, newTitle: String): List<String> {

    // Copy the list of journalists
    val copiedJournalists = journalists.toMutableList()

    // Check if the index is within the boundaries of the list
    if (index >= 0 && index < copiedJournalists.size) {
        // Modify the title of the journalist at the specified index
        copiedJournalists[index] = newTitle
    }

    return copiedJournalists
}