/**
 * As a chef, your task is to create a special dish using the given ingredients from the pantry.
 * However, you need to find the intersection of the ingredients you have and the ingredients required for the dish.
 * Only then you can proceed with preparing the special dish.
 *
 * @param ingredients A set of ingredients required for the special dish.
 * @param pantry A set of ingredients available in the pantry.
 * @return The intersection of the ingredients required for the dish and the ingredients available in the pantry.
 *
 * Hint: Use a break statement to stop the loop and return the required ingredients once the intersection is found.
 *
 * Example:
 * chefsSpecial(setOf("tomatoes", "onions", "garlic"), setOf("onions", "garlic", "carrots")) returns setOf("onions", "garlic")
 */
fun chefsSpecial(ingredients: Set<String>, pantry: Set<String>): Set<String> {

    val requiredIngredients = mutableSetOf<String>()

    for (ingredient in ingredients) {
        for (item in pantry) {
            if (ingredient == item) {
                requiredIngredients.add(ingredient)
                break
            }
        }
    }

    return requiredIngredients
}
/**
 * As a chef, your task is to create a special dish using the given ingredients from the pantry.
 * However, you need to find the intersection of the ingredients you have and the ingredients required for the dish.
 * Only then you can proceed with preparing the special dish.
 *
 * @param ingredients A set of ingredients required for the special dish.
 * @param pantry A set of ingredients available in the pantry.
 * @return The intersection of the ingredients required for the dish and the ingredients available in the pantry.
 *
 * Hint: Use a break statement to stop the loop and return the required ingredients once the intersection is found.
 *
 * Example:
 * chefsSpecial(setOf("tomatoes", "onions", "garlic"), setOf("onions", "garlic", "carrots")) returns setOf("onions", "garlic")
 */
fun chefsSpecial(ingredients: Set<String>, pantry: Set<String>): Set<String> {
/**
 * As a chef, your task is to create a special dish using the given ingredients from the pantry.
 * However, you need to find the intersection of the ingredients you have and the ingredients required for the dish.
 * Only then you can proceed with preparing the special dish.
 *
 * @param ingredients A set of ingredients required for the special dish.
 * @param pantry A set of ingredients available in the pantry.
 * @return The intersection of the ingredients required for the dish and the ingredients available in the pantry.
 *
 * Hint: Use a break statement to stop the loop and return the required ingredients once the intersection is found.
 *
 * Example:
 * chefsSpecial(setOf("tomatoes", "onions", "garlic"), setOf("onions", "garlic", "carrots")) returns setOf("onions", "garlic")
 */
fun chefsSpecial(ingredients: Set<String>, pantry: Set<String>): Set<String> {

    val requiredIngredients = mutableSetOf<String>()

    for (ingredient in ingredients) {
        for (item in pantry) {
            if (ingredient == item) {
                requiredIngredients.add(ingredient)
                break
            }
        }
    }

    return requiredIngredients
}