/**
 * Given two lists containing elements as strings, find the intersection of the lists using the ternary operator.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The list containing the intersection of the two input lists.
 *
 * Example:
 * Input:
 * list1 = ['apple', 'banana', 'orange', 'kiwi']
 * list2 = ['banana', 'grape', 'kiwi', 'lemon']
 *
 * Output:
 * ['banana', 'kiwi']
 */
fun ternaryListIntersection(list1: List<String>, list2: List<String>): List<String> {

    return if (list1.size < list2.size) {
        list1.filter { it in list2 }
    } else {
        list2.filter { it in list1 }
    }
}
/**
 * Given two lists containing elements as strings, find the intersection of the lists using the ternary operator.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The list containing the intersection of the two input lists.
 *
 * Example:
 * Input:
 * list1 = ['apple', 'banana', 'orange', 'kiwi']
 * list2 = ['banana', 'grape', 'kiwi', 'lemon']
 *
 * Output:
 * ['banana', 'kiwi']
 */
fun ternaryListIntersection(list1: List<String>, list2: List<String>): List<String> {
/**
 * Given two lists containing elements as strings, find the intersection of the lists using the ternary operator.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The list containing the intersection of the two input lists.
 *
 * Example:
 * Input:
 * list1 = ['apple', 'banana', 'orange', 'kiwi']
 * list2 = ['banana', 'grape', 'kiwi', 'lemon']
 *
 * Output:
 * ['banana', 'kiwi']
 */
fun ternaryListIntersection(list1: List<String>, list2: List<String>): List<String> {

    return if (list1.size < list2.size) {
        list1.filter { it in list2 }
    } else {
        list2.filter { it in list1 }
    }
}