/**
 * Given a set of customers and a dictionary of purchases made by each customer,
 * return a set containing the customers who made a purchase in every category.
 *
 * @param customers A set of unique customer names (strings).
 * @param purchases A dictionary where keys are customer names and values are sets of categories (strings).
 * @return A set containing the customer names who made a purchase in every category.
 */
fun commonCustomers(customers: Set<String>, purchases: Map<String, Set<String>>): Set<String> {

    // Create a set to store the common customers
    var commonCustomers = HashSet(customers)

    // Iterate over each purchase category
    for (category in purchases.values) {
        // Get the customers who made a purchase in the current category
        val customersInCategory = HashSet(category)

        // Update the common customers set by taking the intersection with the customers in the current category
        commonCustomers.retainAll(customersInCategory)
    }

    return commonCustomers
}
/**
 * Given a set of customers and a dictionary of purchases made by each customer,
 * return a set containing the customers who made a purchase in every category.
 *
 * @param customers A set of unique customer names (strings).
 * @param purchases A dictionary where keys are customer names and values are sets of categories (strings).
 * @return A set containing the customer names who made a purchase in every category.
 */
fun commonCustomers(customers: Set<String>, purchases: Map<String, Set<String>>): Set<String> {
/**
 * Given a set of customers and a dictionary of purchases made by each customer,
 * return a set containing the customers who made a purchase in every category.
 *
 * @param customers A set of unique customer names (strings).
 * @param purchases A dictionary where keys are customer names and values are sets of categories (strings).
 * @return A set containing the customer names who made a purchase in every category.
 */
fun commonCustomers(customers: Set<String>, purchases: Map<String, Set<String>>): Set<String> {

    // Create a set to store the common customers
    var commonCustomers = HashSet(customers)

    // Iterate over each purchase category
    for (category in purchases.values) {
        // Get the customers who made a purchase in the current category
        val customersInCategory = HashSet(category)

        // Update the common customers set by taking the intersection with the customers in the current category
        commonCustomers.retainAll(customersInCategory)
    }

    return commonCustomers
}