/**
 * Given two lists, find and return the common elements
 * that appear in both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A set containing the common elements
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(4, 5, 6, 7)) // Output: setOf(4)
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): Set<Int> {

    val commonElements = mutableSetOf<Int>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}
/**
 * Given two lists, find and return the common elements
 * that appear in both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A set containing the common elements
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(4, 5, 6, 7)) // Output: setOf(4)
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): Set<Int> {
/**
 * Given two lists, find and return the common elements
 * that appear in both lists.
 *
 * @param list1 A list of elements
 * @param list2 A list of elements
 * @return A set containing the common elements
 *
 * Example:
 * findCommonElements(listOf(1, 2, 3, 4), listOf(4, 5, 6, 7)) // Output: setOf(4)
 */
fun findCommonElements(list1: List<Int>, list2: List<Int>): Set<Int> {

    val commonElements = mutableSetOf<Int>()

    for (element1 in list1) {
        for (element2 in list2) {
            if (element1 == element2) {
                commonElements.add(element1)
            }
        }
    }

    return commonElements
}