/**
 * Given two lists of integers, copy the common elements from both lists into a new list.
 * Iterate over each element of both lists using a loop and add the common elements to a new list.
 * Return the new list containing the common elements.
 */
fun copyAndLoop(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                if (num1 !in commonElements) {
                    commonElements.add(num1)
                }
            }
        }
    }
    
    return commonElements
}
/**
 * Given two lists of integers, copy the common elements from both lists into a new list.
 * Iterate over each element of both lists using a loop and add the common elements to a new list.
 * Return the new list containing the common elements.
 */
fun copyAndLoop(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists of integers, copy the common elements from both lists into a new list.
 * Iterate over each element of both lists using a loop and add the common elements to a new list.
 * Return the new list containing the common elements.
 */
fun copyAndLoop(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()
    
    for (num1 in list1) {
        for (num2 in list2) {
            if (num1 == num2) {
                if (num1 !in commonElements) {
                    commonElements.add(num1)
                }
            }
        }
    }
    
    return commonElements
}