/**
 * As a journalist, you have been given a dictionary containing words and their corresponding frequencies. However, there are certain words that need to be removed from the dictionary.
 *
 * Your task is to write a function that takes a dictionary as input and removes the specified words from it. You need to loop through the dictionary and delete the elements from it. Additionally, you need to handle the case where the specified words do not exist in the dictionary.
 *
 * @param dictionary A dictionary containing words as keys and their frequencies as values.
 * @return The modified dictionary with specified words removed.
 */
fun deleteWords(dictionary: MutableMap<String, Int>): MutableMap<String, Int> {

    // List of words to be deleted
    val wordsToDelete = listOf("fake", "biased", "propaganda", "censored")

    // Loop through the dictionary
    val iterator = dictionary.keys.iterator()
    while (iterator.hasNext()) {
        val word = iterator.next()
        // Check if the word needs to be deleted
        if (word in wordsToDelete) {
            iterator.remove()
        }
    }

    return dictionary
}
/**
 * As a journalist, you have been given a dictionary containing words and their corresponding frequencies. However, there are certain words that need to be removed from the dictionary.
 *
 * Your task is to write a function that takes a dictionary as input and removes the specified words from it. You need to loop through the dictionary and delete the elements from it. Additionally, you need to handle the case where the specified words do not exist in the dictionary.
 *
 * @param dictionary A dictionary containing words as keys and their frequencies as values.
 * @return The modified dictionary with specified words removed.
 */
fun deleteWords(dictionary: MutableMap<String, Int>): MutableMap<String, Int> {
/**
 * As a journalist, you have been given a dictionary containing words and their corresponding frequencies. However, there are certain words that need to be removed from the dictionary.
 *
 * Your task is to write a function that takes a dictionary as input and removes the specified words from it. You need to loop through the dictionary and delete the elements from it. Additionally, you need to handle the case where the specified words do not exist in the dictionary.
 *
 * @param dictionary A dictionary containing words as keys and their frequencies as values.
 * @return The modified dictionary with specified words removed.
 */
fun deleteWords(dictionary: MutableMap<String, Int>): MutableMap<String, Int> {

    // List of words to be deleted
    val wordsToDelete = listOf("fake", "biased", "propaganda", "censored")

    // Loop through the dictionary
    val iterator = dictionary.keys.iterator()
    while (iterator.hasNext()) {
        val word = iterator.next()
        // Check if the word needs to be deleted
        if (word in wordsToDelete) {
            iterator.remove()
        }
    }

    return dictionary
}