/**
 * In archaeology, it is often necessary to modify elements of a list while iterating over it.
 * Your task is to implement a function that replaces specific elements with a given replacement value.
 *
 * @param lst A list containing various elements.
 * @param replacement The value to replace the elements in the list.
 * @return The modified list with replaced elements.
 *
 * Example:
 * ---------
 * Given list: [1, 2, 3, 4, 5]
 * Replacement value: "X"
 * Modified list: ["X", 2, "X", 4, "X"]
 */
fun replaceElementsWithIterator(lst: MutableList<Int>, replacement: Int): List<Int> {

    for (i in lst.indices) {
        if (lst[i] % 2 == 0) {
            lst[i] = replacement
        }
    }
    return lst
}
/**
 * In archaeology, it is often necessary to modify elements of a list while iterating over it.
 * Your task is to implement a function that replaces specific elements with a given replacement value.
 *
 * @param lst A list containing various elements.
 * @param replacement The value to replace the elements in the list.
 * @return The modified list with replaced elements.
 *
 * Example:
 * ---------
 * Given list: [1, 2, 3, 4, 5]
 * Replacement value: "X"
 * Modified list: ["X", 2, "X", 4, "X"]
 */
fun replaceElementsWithIterator(lst: MutableList<Int>, replacement: Int): List<Int> {
/**
 * In archaeology, it is often necessary to modify elements of a list while iterating over it.
 * Your task is to implement a function that replaces specific elements with a given replacement value.
 *
 * @param lst A list containing various elements.
 * @param replacement The value to replace the elements in the list.
 * @return The modified list with replaced elements.
 *
 * Example:
 * ---------
 * Given list: [1, 2, 3, 4, 5]
 * Replacement value: "X"
 * Modified list: ["X", 2, "X", 4, "X"]
 */
fun replaceElementsWithIterator(lst: MutableList<Int>, replacement: Int): List<Int> {

    for (i in lst.indices) {
        if (lst[i] % 2 == 0) {
            lst[i] = replacement
        }
    }
    return lst
}