/**
 * This function modifies the given list of elements by removing the specified removals.
 *
 * @param journalist The name of the journalist
 * @param elements The list of elements to be modified
 * @param removals The list of elements to be removed
 * @return The modified list of elements
 *
 * Exercise:
 * Given a list of elements, you need to remove all occurrences of the elements specified in the removals list.
 * Modify the elements list in-place and return the modified list.
 *
 * Example:
 * journalist = "Jack"
 * elements = ['apple', 'banana', 'carrot', 'banana', 'mango', 'pear', 'banana']
 * removals = ['banana', 'carrot']
 * modifyElements(journalist, elements, removals)
 * Output: ['apple', 'mango', 'pear']
 */
fun modifyElements(journalist: String, elements: MutableList<String>, removals: List<String>): List<String> {

    println("Journalist $journalist is modifying the elements list.")
    
    for (item in removals) {
        while (item in elements) {
            elements.remove(item)
        }
    }
    
    return elements
}
/**
 * This function modifies the given list of elements by removing the specified removals.
 *
 * @param journalist The name of the journalist
 * @param elements The list of elements to be modified
 * @param removals The list of elements to be removed
 * @return The modified list of elements
 *
 * Exercise:
 * Given a list of elements, you need to remove all occurrences of the elements specified in the removals list.
 * Modify the elements list in-place and return the modified list.
 *
 * Example:
 * journalist = "Jack"
 * elements = ['apple', 'banana', 'carrot', 'banana', 'mango', 'pear', 'banana']
 * removals = ['banana', 'carrot']
 * modifyElements(journalist, elements, removals)
 * Output: ['apple', 'mango', 'pear']
 */
fun modifyElements(journalist: String, elements: MutableList<String>, removals: List<String>): List<String> {
/**
 * This function modifies the given list of elements by removing the specified removals.
 *
 * @param journalist The name of the journalist
 * @param elements The list of elements to be modified
 * @param removals The list of elements to be removed
 * @return The modified list of elements
 *
 * Exercise:
 * Given a list of elements, you need to remove all occurrences of the elements specified in the removals list.
 * Modify the elements list in-place and return the modified list.
 *
 * Example:
 * journalist = "Jack"
 * elements = ['apple', 'banana', 'carrot', 'banana', 'mango', 'pear', 'banana']
 * removals = ['banana', 'carrot']
 * modifyElements(journalist, elements, removals)
 * Output: ['apple', 'mango', 'pear']
 */
fun modifyElements(journalist: String, elements: MutableList<String>, removals: List<String>): List<String> {

    println("Journalist $journalist is modifying the elements list.")
    
    for (item in removals) {
        while (item in elements) {
            elements.remove(item)
        }
    }
    
    return elements
}