/**
 * This function finds the common elements between two sets.
 *
 * @param rangeStart An integer representing the start of the range.
 * @param rangeEnd An integer representing the end of the range.
 * @param setA A set containing elements to be intersected.
 * @param setB A set containing elements to be intersected.
 * @return A set of common elements between setA and setB.
 */
fun findCommonElements(rangeStart: Int, rangeEnd: Int, setA: Set<Int>, setB: Set<Int>): Set<Int> {

    // Generate a list of numbers using the range function
    val numbers = (rangeStart until rangeEnd).toList()

    // Create an empty set to store the common elements
    val commonElements = mutableSetOf<Int>()

    // Iterate through the numbers and check for common elements
    for (number in numbers) {
        if (number in setA && number in setB) {
            commonElements.add(number)
        }
    }

    return commonElements
}

// Example usage
val rangeStart = 0
val rangeEnd = 10
val setA = setOf(1, 2, 3, 4, 5)
val setB = setOf(4, 5, 6, 7, 8)

val commonElements = findCommonElements(rangeStart, rangeEnd, setA, setB)
/**
 * This function finds the common elements between two sets.
 *
 * @param rangeStart An integer representing the start of the range.
 * @param rangeEnd An integer representing the end of the range.
 * @param setA A set containing elements to be intersected.
 * @param setB A set containing elements to be intersected.
 * @return A set of common elements between setA and setB.
 */
fun findCommonElements(rangeStart: Int, rangeEnd: Int, setA: Set<Int>, setB: Set<Int>): Set<Int> {
/**
 * This function finds the common elements between two sets.
 *
 * @param rangeStart An integer representing the start of the range.
 * @param rangeEnd An integer representing the end of the range.
 * @param setA A set containing elements to be intersected.
 * @param setB A set containing elements to be intersected.
 * @return A set of common elements between setA and setB.
 */
fun findCommonElements(rangeStart: Int, rangeEnd: Int, setA: Set<Int>, setB: Set<Int>): Set<Int> {

    // Generate a list of numbers using the range function
    val numbers = (rangeStart until rangeEnd).toList()

    // Create an empty set to store the common elements
    val commonElements = mutableSetOf<Int>()

    // Iterate through the numbers and check for common elements
    for (number in numbers) {
        if (number in setA && number in setB) {
            commonElements.add(number)
        }
    }

    return commonElements
}

// Example usage
val rangeStart = 0
val rangeEnd = 10
val setA = setOf(1, 2, 3, 4, 5)
val setB = setOf(4, 5, 6, 7, 8)

val commonElements = findCommonElements(rangeStart, rangeEnd, setA, setB)