/**
 * Given two lists, return a new list that contains elements common to both lists.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A new list that contains common elements between the two input lists
 */
fun commonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val common = mutableListOf<Any>()

    // Nested loops to check membership and find common elements
    for (element1 in list1) {
        for (element2 in list2) {
            // Check if element1 is equal to element2
            if (element1 == element2) {
                // Append the common element to the common list
                common.add(element1)
            }
        }
    }

    return common
}
/**
 * Given two lists, return a new list that contains elements common to both lists.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A new list that contains common elements between the two input lists
 */
fun commonElements(list1: List<Any>, list2: List<Any>): List<Any> {
/**
 * Given two lists, return a new list that contains elements common to both lists.
 *
 * @param list1 A list of elements
 * @param list2 Another list of elements
 * @return A new list that contains common elements between the two input lists
 */
fun commonElements(list1: List<Any>, list2: List<Any>): List<Any> {

    val common = mutableListOf<Any>()

    // Nested loops to check membership and find common elements
    for (element1 in list1) {
        for (element2 in list2) {
            // Check if element1 is equal to element2
            if (element1 == element2) {
                // Append the common element to the common list
                common.add(element1)
            }
        }
    }

    return common
}