/**
 * Geologists often compare two lists of rock samples to find out common elements.
 * In this exercise, you need to create a function that takes two lists of rock samples as input
 * and returns a list containing the common elements between the two lists.
 *
 * @param list1 A list of rock samples.
 * @param list2 Another list of rock samples.
 * @return A list containing the common elements found in both lists.
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {

    val commonElements = mutableListOf<String>()

    // Loop through each element in list1
    for (element in list1) {
        // Check if the element is also present in list2
        if (element in list2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}
/**
 * Geologists often compare two lists of rock samples to find out common elements.
 * In this exercise, you need to create a function that takes two lists of rock samples as input
 * and returns a list containing the common elements between the two lists.
 *
 * @param list1 A list of rock samples.
 * @param list2 Another list of rock samples.
 * @return A list containing the common elements found in both lists.
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {
/**
 * Geologists often compare two lists of rock samples to find out common elements.
 * In this exercise, you need to create a function that takes two lists of rock samples as input
 * and returns a list containing the common elements between the two lists.
 *
 * @param list1 A list of rock samples.
 * @param list2 Another list of rock samples.
 * @return A list containing the common elements found in both lists.
 */
fun findCommonElements(list1: List<String>, list2: List<String>): List<String> {

    val commonElements = mutableListOf<String>()

    // Loop through each element in list1
    for (element in list1) {
        // Check if the element is also present in list2
        if (element in list2 && element !in commonElements) {
            commonElements.add(element)
        }
    }

    return commonElements
}