/**
 * Given a list of lists, the function finds the common elements
 * among all the inner lists and returns them as a list.
 *
 * @param list_of_lists A list containing multiple inner lists.
 * @return A list containing the common elements among all the inner lists.
 */
fun findCommonElements(listOfLists: List<List<String>>): List<String> {

    // Initialize a set with the first inner list
    var commonElements = listOfLists[0].toSet()

    // Iterate over the remaining inner lists
    for (innerList in listOfLists.subList(1, listOfLists.size)) {
        // Create a set from the current inner list
        val innerSet = innerList.toSet()

        // Update the commonElements set by taking the intersection
        commonElements = commonElements.intersect(innerSet)
    }

    // Return the common elements as a list
    return commonElements.toList()
}

// Example Usage
/**
 * Given a list of lists, the function finds the common elements
 * among all the inner lists and returns them as a list.
 *
 * @param list_of_lists A list containing multiple inner lists.
 * @return A list containing the common elements among all the inner lists.
 */
fun findCommonElements(listOfLists: List<List<String>>): List<String> {
/**
 * Given a list of lists, the function finds the common elements
 * among all the inner lists and returns them as a list.
 *
 * @param list_of_lists A list containing multiple inner lists.
 * @return A list containing the common elements among all the inner lists.
 */
fun findCommonElements(listOfLists: List<List<String>>): List<String> {

    // Initialize a set with the first inner list
    var commonElements = listOfLists[0].toSet()

    // Iterate over the remaining inner lists
    for (innerList in listOfLists.subList(1, listOfLists.size)) {
        // Create a set from the current inner list
        val innerSet = innerList.toSet()

        // Update the commonElements set by taking the intersection
        commonElements = commonElements.intersect(innerSet)
    }

    // Return the common elements as a list
    return commonElements.toList()
}

// Example Usage