/**
 * This function takes in two lists of sets and finds the common elements between them.
 * It uses nested loops with break and continue statements to optimize the search process.
 *
 * @param list1 A list containing sets of elements
 * @param list2 Another list containing sets of elements
 * @return A set containing the common elements found in both lists
 */
fun findCommonElements(list1: List<Set<String>>, list2: List<Set<String>>): Set<String> {

    val commonElements = mutableSetOf<String>()

    for (set1 in list1) {
        for (set2 in list2) {
            for (ele1 in set1) {
                if (ele1 in set2) {
                    commonElements.add(ele1)
                    break
                }
            }
        }
    }

    return commonElements
}

// Example usage
/**
 * This function takes in two lists of sets and finds the common elements between them.
 * It uses nested loops with break and continue statements to optimize the search process.
 *
 * @param list1 A list containing sets of elements
 * @param list2 Another list containing sets of elements
 * @return A set containing the common elements found in both lists
 */
fun findCommonElements(list1: List<Set<String>>, list2: List<Set<String>>): Set<String> {
/**
 * This function takes in two lists of sets and finds the common elements between them.
 * It uses nested loops with break and continue statements to optimize the search process.
 *
 * @param list1 A list containing sets of elements
 * @param list2 Another list containing sets of elements
 * @return A set containing the common elements found in both lists
 */
fun findCommonElements(list1: List<Set<String>>, list2: List<Set<String>>): Set<String> {

    val commonElements = mutableSetOf<String>()

    for (set1 in list1) {
        for (set2 in list2) {
            for (ele1 in set1) {
                if (ele1 in set2) {
                    commonElements.add(ele1)
                    break
                }
            }
        }
    }

    return commonElements
}

// Example usage