/**
 * This function takes two lists as input and returns a list containing their common elements.
 */
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) {
        // Initialize a boolean variable to check if the element is common
        var isCommon = false

        // Iterate through each element in the second list
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Set the boolean variable to true and break out of the loop
                isCommon = true
                break
            }
        }

        // Check if the element is common
        if (isCommon) {
            // Append the element to the common elements list
            commonElements.add(element1)
        }
    }

    // Return the common elements list
    return commonElements
}
/**
 * This function takes two lists as input and returns a list containing their common elements.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * This function takes two lists as input and returns a list containing their common elements.
 */
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) {
        // Initialize a boolean variable to check if the element is common
        var isCommon = false

        // Iterate through each element in the second list
        for (element2 in list2) {
            // Check if the elements are equal
            if (element1 == element2) {
                // Set the boolean variable to true and break out of the loop
                isCommon = true
                break
            }
        }

        // Check if the element is common
        if (isCommon) {
            // Append the element to the common elements list
            commonElements.add(element1)
        }
    }

    // Return the common elements list
    return commonElements
}