/**
 * This function takes two sets as input and returns a new set that contains only the elements 
 * which are present in both sets. The sets are processed using nested loops.
 * 
 * @param outerSet The outer set.
 * @param innerSet The inner set.
 * @return A new set containing the elements present in both outerSet and innerSet.
 */
fun nestedLoopIntersection(outerSet: Set<Any>, innerSet: Set<Any>): Set<Any> {

    val intersectionSet = mutableSetOf<Any>()

    // Nested loop to iterate through each element of the outer set
    for (outerElement in outerSet) {
        // Nested loop to check intersection with each element of the inner set
        for (innerElement in innerSet) {
            if (outerElement == innerElement) {
                intersectionSet.add(outerElement)
            }
        }
    }

    return intersectionSet
}
/**
 * This function takes two sets as input and returns a new set that contains only the elements 
 * which are present in both sets. The sets are processed using nested loops.
 * 
 * @param outerSet The outer set.
 * @param innerSet The inner set.
 * @return A new set containing the elements present in both outerSet and innerSet.
 */
fun nestedLoopIntersection(outerSet: Set<Any>, innerSet: Set<Any>): Set<Any> {
/**
 * This function takes two sets as input and returns a new set that contains only the elements 
 * which are present in both sets. The sets are processed using nested loops.
 * 
 * @param outerSet The outer set.
 * @param innerSet The inner set.
 * @return A new set containing the elements present in both outerSet and innerSet.
 */
fun nestedLoopIntersection(outerSet: Set<Any>, innerSet: Set<Any>): Set<Any> {

    val intersectionSet = mutableSetOf<Any>()

    // Nested loop to iterate through each element of the outer set
    for (outerElement in outerSet) {
        // Nested loop to check intersection with each element of the inner set
        for (innerElement in innerSet) {
            if (outerElement == innerElement) {
                intersectionSet.add(outerElement)
            }
        }
    }

    return intersectionSet
}