/**
 * This function takes in two lists of rocks and finds the common minerals present in both lists.
 *
 * @param rocks1 A list of rocks containing minerals.
 * @param rocks2 Another list of rocks containing minerals.
 * @return A list of common minerals found in both lists of rocks.
 */
fun findCommonMinerals(rocks1: List<List<String>>, rocks2: List<List<String>>): List<String> {

    val commonMinerals = mutableListOf<String>()

    for (rock1 in rocks1) {
        for (rock2 in rocks2) {
            for (mineral1 in rock1) {
                for (mineral2 in rock2) {
                    if (mineral1 == mineral2 && mineral1 !in commonMinerals) {
                        commonMinerals.add(mineral1)
                    }
                }
            }
        }
    }

    return commonMinerals
}
/**
 * This function takes in two lists of rocks and finds the common minerals present in both lists.
 *
 * @param rocks1 A list of rocks containing minerals.
 * @param rocks2 Another list of rocks containing minerals.
 * @return A list of common minerals found in both lists of rocks.
 */
fun findCommonMinerals(rocks1: List<List<String>>, rocks2: List<List<String>>): List<String> {
/**
 * This function takes in two lists of rocks and finds the common minerals present in both lists.
 *
 * @param rocks1 A list of rocks containing minerals.
 * @param rocks2 Another list of rocks containing minerals.
 * @return A list of common minerals found in both lists of rocks.
 */
fun findCommonMinerals(rocks1: List<List<String>>, rocks2: List<List<String>>): List<String> {

    val commonMinerals = mutableListOf<String>()

    for (rock1 in rocks1) {
        for (rock2 in rocks2) {
            for (mineral1 in rock1) {
                for (mineral2 in rock2) {
                    if (mineral1 == mineral2 && mineral1 !in commonMinerals) {
                        commonMinerals.add(mineral1)
                    }
                }
            }
        }
    }

    return commonMinerals
}