/**
 * Given a list of psychologists, the task is to write a function that returns a new list containing the names
 * of the psychologists who specialize in both children and adults.
 *
 * @param psychologistList A list of psychologists where each element is a Pair containing the name of the psychologist
 *                         as the first element and the specialization as the second element.
 * @return A new list containing the names of psychologists who specialize in both children and adults.
 */
fun nestedTernaryOperatorsLists(psychologistList: List<Pair<String, String>>): List<String> {

    // The function starts by using nested ternary operators to filter the psychologists who specialize in both children and adults.
    // Then, a list comprehension is used to extract only the names of those psychologists and return the final list.
    return psychologistList.filter { it.second == "children" && it.second == "adults" }
        .map { it.first }
}
/**
 * Given a list of psychologists, the task is to write a function that returns a new list containing the names
 * of the psychologists who specialize in both children and adults.
 *
 * @param psychologistList A list of psychologists where each element is a Pair containing the name of the psychologist
 *                         as the first element and the specialization as the second element.
 * @return A new list containing the names of psychologists who specialize in both children and adults.
 */
fun nestedTernaryOperatorsLists(psychologistList: List<Pair<String, String>>): List<String> {
/**
 * Given a list of psychologists, the task is to write a function that returns a new list containing the names
 * of the psychologists who specialize in both children and adults.
 *
 * @param psychologistList A list of psychologists where each element is a Pair containing the name of the psychologist
 *                         as the first element and the specialization as the second element.
 * @return A new list containing the names of psychologists who specialize in both children and adults.
 */
fun nestedTernaryOperatorsLists(psychologistList: List<Pair<String, String>>): List<String> {

    // The function starts by using nested ternary operators to filter the psychologists who specialize in both children and adults.
    // Then, a list comprehension is used to extract only the names of those psychologists and return the final list.
    return psychologistList.filter { it.second == "children" && it.second == "adults" }
        .map { it.first }
}