/**
 * A chef wants to remove all the ingredients from their pantry that are not used in a recipe.
 * Write a function that takes a list of ingredients in the pantry and a list of ingredients in the recipe,
 * and returns a new list with only the common ingredients found in both lists.
 *
 * Example:
 * pantry = ["flour", "sugar", "salt", "butter", "eggs", "milk"]
 * recipe = ["flour", "butter", "sugar"]
 *
 * removeUncommonIngredients(pantry, recipe) -> ['flour', 'sugar', 'butter']
 */
fun removeUncommonIngredients(pantry: List<String>, recipe: List<String>): List<String> {

    val commonIngredients = pantry.filter { it in recipe }
    return commonIngredients
}
/**
 * A chef wants to remove all the ingredients from their pantry that are not used in a recipe.
 * Write a function that takes a list of ingredients in the pantry and a list of ingredients in the recipe,
 * and returns a new list with only the common ingredients found in both lists.
 *
 * Example:
 * pantry = ["flour", "sugar", "salt", "butter", "eggs", "milk"]
 * recipe = ["flour", "butter", "sugar"]
 *
 * removeUncommonIngredients(pantry, recipe) -> ['flour', 'sugar', 'butter']
 */
fun removeUncommonIngredients(pantry: List<String>, recipe: List<String>): List<String> {
/**
 * A chef wants to remove all the ingredients from their pantry that are not used in a recipe.
 * Write a function that takes a list of ingredients in the pantry and a list of ingredients in the recipe,
 * and returns a new list with only the common ingredients found in both lists.
 *
 * Example:
 * pantry = ["flour", "sugar", "salt", "butter", "eggs", "milk"]
 * recipe = ["flour", "butter", "sugar"]
 *
 * removeUncommonIngredients(pantry, recipe) -> ['flour', 'sugar', 'butter']
 */
fun removeUncommonIngredients(pantry: List<String>, recipe: List<String>): List<String> {

    val commonIngredients = pantry.filter { it in recipe }
    return commonIngredients
}