/**
 * Given two lists of elements, find the common elements present in both lists.
 *
 * @param list1 A list containing the elements.
 * @param list2 Another list containing some elements.
 * @return A list of common elements found in both lists.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over the elements in list1
    for (element1 in list1) {
        // Iterate over the elements in list2
        for (element2 in list2) {
            // Check if the elements match
            if (element1 == element2) {
                // Check if the common element is not already in the commonElements list
                if (!commonElements.contains(element1)) {
                    // Add the common element to the commonElements list
                    commonElements.add(element1)
                }
            }
        }
    }

    return commonElements
}

// Example usage
/**
 * Given two lists of elements, find the common elements present in both lists.
 *
 * @param list1 A list containing the elements.
 * @param list2 Another list containing some elements.
 * @return A list of common elements found in both lists.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists of elements, find the common elements present in both lists.
 *
 * @param list1 A list containing the elements.
 * @param list2 Another list containing some elements.
 * @return A list of common elements found in both lists.
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): List<Int> {

    val commonElements = mutableListOf<Int>()

    // Iterate over the elements in list1
    for (element1 in list1) {
        // Iterate over the elements in list2
        for (element2 in list2) {
            // Check if the elements match
            if (element1 == element2) {
                // Check if the common element is not already in the commonElements list
                if (!commonElements.contains(element1)) {
                    // Add the common element to the commonElements list
                    commonElements.add(element1)
                }
            }
        }
    }

    return commonElements
}

// Example usage