/**
 * Given a list 'lst' and an 'element', replace all occurrences of 'element' with the next element in the list.
 *
 * @param lst The original list.
 * @param element The element to be replaced.
 * @return The modified list.
 */
fun replaceOccurrenceWithNextElement(lst: MutableList<Any>, element: Any): List<Any> {

    // Iterate through the list
    for (i in 0 until lst.size) {
        if (lst[i] == element) {
            // Check if current element is not the last element
            if (i != lst.size - 1) {
                // Replace the current element with the next element in the list
                lst[i] = lst[i + 1]
            }
        }
    }
    return lst
}
/**
 * Given a list 'lst' and an 'element', replace all occurrences of 'element' with the next element in the list.
 *
 * @param lst The original list.
 * @param element The element to be replaced.
 * @return The modified list.
 */
fun replaceOccurrenceWithNextElement(lst: MutableList<Any>, element: Any): List<Any> {
/**
 * Given a list 'lst' and an 'element', replace all occurrences of 'element' with the next element in the list.
 *
 * @param lst The original list.
 * @param element The element to be replaced.
 * @return The modified list.
 */
fun replaceOccurrenceWithNextElement(lst: MutableList<Any>, element: Any): List<Any> {

    // Iterate through the list
    for (i in 0 until lst.size) {
        if (lst[i] == element) {
            // Check if current element is not the last element
            if (i != lst.size - 1) {
                // Replace the current element with the next element in the list
                lst[i] = lst[i + 1]
            }
        }
    }
    return lst
}