/**
 * Given two tuples, this function returns a new tuple that contains the intersection of the elements in the two tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Intersection of elements in tuple1 and tuple2
 */
fun intersectionOfTuples(tuple1: List<Int>, tuple2: List<Int>): List<Int> {

    // Concatenate the given tuples
    val concatenatedTuple = tuple1 + tuple2
    
    // Sort the concatenated tuple in ascending order
    val sortedTuple = concatenatedTuple.sorted()
    
    // Initialize a list to store the repeated elements
    val repeatedElements = mutableListOf<Int>()
    
    for (i in 0 until sortedTuple.size - 1) {
        // Check if an element is greater than the next element
        if (sortedTuple[i] > sortedTuple[i + 1]) {
            // Add the greater element to the repeated elements list
            repeatedElements.add(sortedTuple[i])
        }
    }
    
    return repeatedElements
}
/**
 * Given two tuples, this function returns a new tuple that contains the intersection of the elements in the two tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Intersection of elements in tuple1 and tuple2
 */
fun intersectionOfTuples(tuple1: List<Int>, tuple2: List<Int>): List<Int> {
/**
 * Given two tuples, this function returns a new tuple that contains the intersection of the elements in the two tuples.
 *
 * @param tuple1 First tuple
 * @param tuple2 Second tuple
 * @return Intersection of elements in tuple1 and tuple2
 */
fun intersectionOfTuples(tuple1: List<Int>, tuple2: List<Int>): List<Int> {

    // Concatenate the given tuples
    val concatenatedTuple = tuple1 + tuple2
    
    // Sort the concatenated tuple in ascending order
    val sortedTuple = concatenatedTuple.sorted()
    
    // Initialize a list to store the repeated elements
    val repeatedElements = mutableListOf<Int>()
    
    for (i in 0 until sortedTuple.size - 1) {
        // Check if an element is greater than the next element
        if (sortedTuple[i] > sortedTuple[i + 1]) {
            // Add the greater element to the repeated elements list
            repeatedElements.add(sortedTuple[i])
        }
    }
    
    return repeatedElements
}