/**
 * This function checks if a chef knows how to cook a particular meal
 * based on the available ingredients. It returns the names of the chefs
 * who can cook the meal.
 *
 * @param chefs A list of chefs (strings)
 * @param ingredients A dictionary that maps ingredients to the chefs who know
 * how to cook with them (dictionary)
 * @param meals A list of meals to be checked (strings)
 * @return A list of names of chefs who can cook the given meals (list of strings)
 */
fun identify(chefs: List<String>, ingredients: Map<String, List<String>>, meals: List<String>): List<String> {

    val matchingChefs = mutableListOf<String>()

    for (meal in meals) {
        val mealChefs = ingredients.getOrDefault(meal, emptyList())

        for (chef in chefs) {
            if (chef in mealChefs && chef !in matchingChefs) {
                matchingChefs.add(chef)
            }
        }
    }

    return matchingChefs
}
/**
 * This function checks if a chef knows how to cook a particular meal
 * based on the available ingredients. It returns the names of the chefs
 * who can cook the meal.
 *
 * @param chefs A list of chefs (strings)
 * @param ingredients A dictionary that maps ingredients to the chefs who know
 * how to cook with them (dictionary)
 * @param meals A list of meals to be checked (strings)
 * @return A list of names of chefs who can cook the given meals (list of strings)
 */
fun identify(chefs: List<String>, ingredients: Map<String, List<String>>, meals: List<String>): List<String> {
/**
 * This function checks if a chef knows how to cook a particular meal
 * based on the available ingredients. It returns the names of the chefs
 * who can cook the meal.
 *
 * @param chefs A list of chefs (strings)
 * @param ingredients A dictionary that maps ingredients to the chefs who know
 * how to cook with them (dictionary)
 * @param meals A list of meals to be checked (strings)
 * @return A list of names of chefs who can cook the given meals (list of strings)
 */
fun identify(chefs: List<String>, ingredients: Map<String, List<String>>, meals: List<String>): List<String> {

    val matchingChefs = mutableListOf<String>()

    for (meal in meals) {
        val mealChefs = ingredients.getOrDefault(meal, emptyList())

        for (chef in chefs) {
            if (chef in mealChefs && chef !in matchingChefs) {
                matchingChefs.add(chef)
            }
        }
    }

    return matchingChefs
}