/**
 * Given two lists of ingredients in a chef's pantries, find the common ingredients between the two.
 *
 * @param pantry1 A list of ingredients in the first pantry.
 * @param pantry2 A list of ingredients in the second pantry.
 * @return A list containing the common ingredients found.
 *
 * Example:
 * val pantry1 = listOf("flour", "sugar", "salt", "butter")
 * val pantry2 = listOf("flour", "yeast", "sugar", "vanilla")
 * findCommonIngredients(pantry1, pantry2) => ["flour", "sugar"]
 */
fun findCommonIngredients(pantry1: List<String>, pantry2: List<String>): List<String> {

    val commonIngredients = mutableListOf<String>()

    // Iterate through the ingredients in the first pantry
    for (ingredient1 in pantry1) {
        // Check if the ingredient is present in the second pantry
        if (ingredient1 in pantry2) {
            // Add the ingredient to the list of common ingredients
            commonIngredients.add(ingredient1)
        }
    }

    return commonIngredients
}
/**
 * Given two lists of ingredients in a chef's pantries, find the common ingredients between the two.
 *
 * @param pantry1 A list of ingredients in the first pantry.
 * @param pantry2 A list of ingredients in the second pantry.
 * @return A list containing the common ingredients found.
 *
 * Example:
 * val pantry1 = listOf("flour", "sugar", "salt", "butter")
 * val pantry2 = listOf("flour", "yeast", "sugar", "vanilla")
 * findCommonIngredients(pantry1, pantry2) => ["flour", "sugar"]
 */
fun findCommonIngredients(pantry1: List<String>, pantry2: List<String>): List<String> {
/**
 * Given two lists of ingredients in a chef's pantries, find the common ingredients between the two.
 *
 * @param pantry1 A list of ingredients in the first pantry.
 * @param pantry2 A list of ingredients in the second pantry.
 * @return A list containing the common ingredients found.
 *
 * Example:
 * val pantry1 = listOf("flour", "sugar", "salt", "butter")
 * val pantry2 = listOf("flour", "yeast", "sugar", "vanilla")
 * findCommonIngredients(pantry1, pantry2) => ["flour", "sugar"]
 */
fun findCommonIngredients(pantry1: List<String>, pantry2: List<String>): List<String> {

    val commonIngredients = mutableListOf<String>()

    // Iterate through the ingredients in the first pantry
    for (ingredient1 in pantry1) {
        // Check if the ingredient is present in the second pantry
        if (ingredient1 in pantry2) {
            // Add the ingredient to the list of common ingredients
            commonIngredients.add(ingredient1)
        }
    }

    return commonIngredients
}