/**
 * Given a dictionary of items and their occurrences, modify the dictionary in-place
 * to remove any items with an occurrence less than 3, and return the modified dictionary.
 *
 * @param items A dictionary of items and their occurrences.
 * @return The modified dictionary with items occurring at least 3 times.
 */
fun countOccurrences(items: MutableMap<String, Int>): MutableMap<String, Int> {

    // Initialize an empty dictionary to store the modified items
    val modifiedItems = mutableMapOf<String, Int>()

    // Iterate over each item in the dictionary
    for ((item, count) in items) {
        // Check if the occurrence count is less than 3
        if (count < 3) {
            // If so, skip this item and move to the next one
            continue
        }

        // Otherwise, add the item and its occurrence count to the modified dictionary
        modifiedItems[item] = count
    }

    // Update the original dictionary with the modified items
    items.putAll(modifiedItems)

    // Return the modified dictionary
    return items
}
/**
 * Given a dictionary of items and their occurrences, modify the dictionary in-place
 * to remove any items with an occurrence less than 3, and return the modified dictionary.
 *
 * @param items A dictionary of items and their occurrences.
 * @return The modified dictionary with items occurring at least 3 times.
 */
fun countOccurrences(items: MutableMap<String, Int>): MutableMap<String, Int> {
/**
 * Given a dictionary of items and their occurrences, modify the dictionary in-place
 * to remove any items with an occurrence less than 3, and return the modified dictionary.
 *
 * @param items A dictionary of items and their occurrences.
 * @return The modified dictionary with items occurring at least 3 times.
 */
fun countOccurrences(items: MutableMap<String, Int>): MutableMap<String, Int> {

    // Initialize an empty dictionary to store the modified items
    val modifiedItems = mutableMapOf<String, Int>()

    // Iterate over each item in the dictionary
    for ((item, count) in items) {
        // Check if the occurrence count is less than 3
        if (count < 3) {
            // If so, skip this item and move to the next one
            continue
        }

        // Otherwise, add the item and its occurrence count to the modified dictionary
        modifiedItems[item] = count
    }

    // Update the original dictionary with the modified items
    items.putAll(modifiedItems)

    // Return the modified dictionary
    return items
}