/**
 * Given a tuple of tuples and a list, return a list containing all the elements that are present
 * in all the tuples and also in the list.
 *
 * @param tuples A tuple of tuples, each tuple containing elements.
 * @param lst A list containing elements.
 * @return A list containing the common elements.
 *
 * Example:
 * getCommonElements(listOf(listOf("A", "B", "C"), listOf("A", "C", "D"), listOf("A", "E", "F")), listOf("A", "C", "F"))
 * Output: ['A', 'C', 'F']
 */
fun getCommonElements(tuples: List<List<String>>, lst: List<String>): List<String> {

    val commonElements = mutableListOf<String>()
    for (tup in tuples) {
        commonElements.addAll(tup.filter { it in lst })
    }
    return commonElements
}
/**
 * Given a tuple of tuples and a list, return a list containing all the elements that are present
 * in all the tuples and also in the list.
 *
 * @param tuples A tuple of tuples, each tuple containing elements.
 * @param lst A list containing elements.
 * @return A list containing the common elements.
 *
 * Example:
 * getCommonElements(listOf(listOf("A", "B", "C"), listOf("A", "C", "D"), listOf("A", "E", "F")), listOf("A", "C", "F"))
 * Output: ['A', 'C', 'F']
 */
fun getCommonElements(tuples: List<List<String>>, lst: List<String>): List<String> {
/**
 * Given a tuple of tuples and a list, return a list containing all the elements that are present
 * in all the tuples and also in the list.
 *
 * @param tuples A tuple of tuples, each tuple containing elements.
 * @param lst A list containing elements.
 * @return A list containing the common elements.
 *
 * Example:
 * getCommonElements(listOf(listOf("A", "B", "C"), listOf("A", "C", "D"), listOf("A", "E", "F")), listOf("A", "C", "F"))
 * Output: ['A', 'C', 'F']
 */
fun getCommonElements(tuples: List<List<String>>, lst: List<String>): List<String> {

    val commonElements = mutableListOf<String>()
    for (tup in tuples) {
        commonElements.addAll(tup.filter { it in lst })
    }
    return commonElements
}