/**
 * Takes a list of criminals and a list of arrested criminals as input.
 * Modifies the criminals list by removing the arrested criminals from it.
 *
 * @param policeOfficer The name of the police officer.
 * @param criminals The list of criminals.
 * @param arrestedCriminals The list of arrested criminals.
 * @return The modified list of criminals after removing the arrested ones.
 */
fun modifyList(policeOfficer: String, criminals: MutableList<String>, arrestedCriminals: List<String>): List<String> {

    // Displaying the instructions to the police officer
    println("Police Officer $policeOfficer, you have a task at hand!")
    println("Your mission is to remove the arrested criminals from the list of criminals.")
    println("Let's begin!")

    // Create a copy of the criminals list to avoid ConcurrentModificationException
    val modifiedCriminals = ArrayList(criminals)

    // Iterating over the arrested criminals
    for (criminal in arrestedCriminals) {
        // Check if the current criminal is in the list of criminals
        if (criminal in modifiedCriminals) {
            // Remove the arrested criminal from the list of criminals
            modifiedCriminals.remove(criminal)
        }
    }

    // Displaying the modified list of criminals
    println("Updated list of criminals:")
    println(modifiedCriminals)
    return modifiedCriminals
}
/**
 * Takes a list of criminals and a list of arrested criminals as input.
 * Modifies the criminals list by removing the arrested criminals from it.
 *
 * @param policeOfficer The name of the police officer.
 * @param criminals The list of criminals.
 * @param arrestedCriminals The list of arrested criminals.
 * @return The modified list of criminals after removing the arrested ones.
 */
fun modifyList(policeOfficer: String, criminals: MutableList<String>, arrestedCriminals: List<String>): List<String> {
/**
 * Takes a list of criminals and a list of arrested criminals as input.
 * Modifies the criminals list by removing the arrested criminals from it.
 *
 * @param policeOfficer The name of the police officer.
 * @param criminals The list of criminals.
 * @param arrestedCriminals The list of arrested criminals.
 * @return The modified list of criminals after removing the arrested ones.
 */
fun modifyList(policeOfficer: String, criminals: MutableList<String>, arrestedCriminals: List<String>): List<String> {

    // Displaying the instructions to the police officer
    println("Police Officer $policeOfficer, you have a task at hand!")
    println("Your mission is to remove the arrested criminals from the list of criminals.")
    println("Let's begin!")

    // Create a copy of the criminals list to avoid ConcurrentModificationException
    val modifiedCriminals = ArrayList(criminals)

    // Iterating over the arrested criminals
    for (criminal in arrestedCriminals) {
        // Check if the current criminal is in the list of criminals
        if (criminal in modifiedCriminals) {
            // Remove the arrested criminal from the list of criminals
            modifiedCriminals.remove(criminal)
        }
    }

    // Displaying the modified list of criminals
    println("Updated list of criminals:")
    println(modifiedCriminals)
    return modifiedCriminals
}