/**
 * This function finds the common elements between two lists using nested loops.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Int>()
    
    // Iterate through each element in the first list
    for (element1 in list1) {
        // Iterate through each element in the second list
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the list
                commonElements.add(element1)
            }
        }
    }
    
    // Return the list of common elements
    return commonElements
}
/**
 * This function finds the common elements between two lists using nested loops.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This function finds the common elements between two lists using nested loops.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    // Initialize an empty list to store the common elements
    val commonElements = mutableListOf<Int>()
    
    // Iterate through each element in the first list
    for (element1 in list1) {
        // Iterate through each element in the second list
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Add the common element to the list
                commonElements.add(element1)
            }
        }
    }
    
    // Return the list of common elements
    return commonElements
}