/**
 * Chef's special code for accessing tuple elements.
 *
 * Given a chef's name and a list containing the ingredients for a dish,
 * this function will return the chef's name and the second-to-last ingredient in the list.
 *
 * @param chefName Name of the chef.
 * @param dishIngredients List containing the ingredients for a dish.
 * @return Pair<String, String> A pair containing chef's name and the second-to-last ingredient.
 *
 * Example:
 * accessTupleElements("Chef Gordon", listOf("salt", "pepper", "garlic", "butter", "onion"))
 * Output: Pair("Chef Gordon", "butter")
 */
fun accessTupleElements(chefName: String, dishIngredients: List<String>): Pair<String, String> {

    // Check if the given list has at least two elements
    if (dishIngredients.size < 2) {
        return Pair("Insufficient ingredients!", "")
    }

    // Access and return the chef's name along with the second-to-last ingredient
    return Pair(chefName, dishIngredients[dishIngredients.size - 2])
}
/**
 * Chef's special code for accessing tuple elements.
 *
 * Given a chef's name and a list containing the ingredients for a dish,
 * this function will return the chef's name and the second-to-last ingredient in the list.
 *
 * @param chefName Name of the chef.
 * @param dishIngredients List containing the ingredients for a dish.
 * @return Pair<String, String> A pair containing chef's name and the second-to-last ingredient.
 *
 * Example:
 * accessTupleElements("Chef Gordon", listOf("salt", "pepper", "garlic", "butter", "onion"))
 * Output: Pair("Chef Gordon", "butter")
 */
fun accessTupleElements(chefName: String, dishIngredients: List<String>): Pair<String, String> {
/**
 * Chef's special code for accessing tuple elements.
 *
 * Given a chef's name and a list containing the ingredients for a dish,
 * this function will return the chef's name and the second-to-last ingredient in the list.
 *
 * @param chefName Name of the chef.
 * @param dishIngredients List containing the ingredients for a dish.
 * @return Pair<String, String> A pair containing chef's name and the second-to-last ingredient.
 *
 * Example:
 * accessTupleElements("Chef Gordon", listOf("salt", "pepper", "garlic", "butter", "onion"))
 * Output: Pair("Chef Gordon", "butter")
 */
fun accessTupleElements(chefName: String, dishIngredients: List<String>): Pair<String, String> {

    // Check if the given list has at least two elements
    if (dishIngredients.size < 2) {
        return Pair("Insufficient ingredients!", "")
    }

    // Access and return the chef's name along with the second-to-last ingredient
    return Pair(chefName, dishIngredients[dishIngredients.size - 2])
}