/**
 * This function takes in two lists of ingredients for two chefs and finds the common ingredients in both lists.
 *
 * @param chef1 List of ingredients for chef1
 * @param chef2 List of ingredients for chef2
 * @return List of common ingredients in both chef1 and chef2
 */
fun findCommonElements(chef1: List<String>, chef2: List<String>): List<String> {

    // Initialize an empty list to store common ingredients
    val commonIngredients = mutableListOf<String>()

    // Iterate over each element in chef1 list
    for (ingredient1 in chef1) {
        // Iterate over each element in chef2 list
        for (ingredient2 in chef2) {
            // Check if the current ingredient from chef1 exists in chef2
            if (ingredient1 == ingredient2) {
                // Append the common ingredient to the commonIngredients list
                commonIngredients.add(ingredient1)
                // Break out of the inner loop because we have found a match
                break
            }
        }
    }

    return commonIngredients
}

// Example usage
val chef1 = listOf("salt", "pepper", "sugar", "flour", "butter")
val chef2 = listOf("pepper")
/**
 * This function takes in two lists of ingredients for two chefs and finds the common ingredients in both lists.
 *
 * @param chef1 List of ingredients for chef1
 * @param chef2 List of ingredients for chef2
 * @return List of common ingredients in both chef1 and chef2
 */
fun findCommonElements(chef1: List<String>, chef2: List<String>): List<String> {
/**
 * This function takes in two lists of ingredients for two chefs and finds the common ingredients in both lists.
 *
 * @param chef1 List of ingredients for chef1
 * @param chef2 List of ingredients for chef2
 * @return List of common ingredients in both chef1 and chef2
 */
fun findCommonElements(chef1: List<String>, chef2: List<String>): List<String> {

    // Initialize an empty list to store common ingredients
    val commonIngredients = mutableListOf<String>()

    // Iterate over each element in chef1 list
    for (ingredient1 in chef1) {
        // Iterate over each element in chef2 list
        for (ingredient2 in chef2) {
            // Check if the current ingredient from chef1 exists in chef2
            if (ingredient1 == ingredient2) {
                // Append the common ingredient to the commonIngredients list
                commonIngredients.add(ingredient1)
                // Break out of the inner loop because we have found a match
                break
            }
        }
    }

    return commonIngredients
}

// Example usage
val chef1 = listOf("salt", "pepper", "sugar", "flour", "butter")
val chef2 = listOf("pepper")