/**
 * As an anthropologist, you have collected two lists of species found in two different regions.
 * Your task is to write a function that finds the common species between the two lists using branching statements.
 *
 * @param speciesList1 A list of species found in region 1.
 * @param speciesList2 A list of species found in region 2.
 * @return A list containing the common species found in both regions.
 *
 * Note:
 * - Consider species names as strings.
 * - Ignore the case of species names (case-insensitive comparison).
 * - The order of species in the final list does not matter.
 * - If no common species are found, return an empty list ([]).
 */
fun findCommonSpecies(speciesList1: List<String>, speciesList2: List<String>): List<String> {

    val commonSpecies = mutableListOf<String>()  // Create an empty list to store common species

    for (species1 in speciesList1) {
        for (species2 in speciesList2) {
            if (species1.equals(species2, ignoreCase = true)) {
                commonSpecies.add(species1)  // Add the common species to the list
            }
        }
    }

    return commonSpecies
}
/**
 * As an anthropologist, you have collected two lists of species found in two different regions.
 * Your task is to write a function that finds the common species between the two lists using branching statements.
 *
 * @param speciesList1 A list of species found in region 1.
 * @param speciesList2 A list of species found in region 2.
 * @return A list containing the common species found in both regions.
 *
 * Note:
 * - Consider species names as strings.
 * - Ignore the case of species names (case-insensitive comparison).
 * - The order of species in the final list does not matter.
 * - If no common species are found, return an empty list ([]).
 */
fun findCommonSpecies(speciesList1: List<String>, speciesList2: List<String>): List<String> {
/**
 * As an anthropologist, you have collected two lists of species found in two different regions.
 * Your task is to write a function that finds the common species between the two lists using branching statements.
 *
 * @param speciesList1 A list of species found in region 1.
 * @param speciesList2 A list of species found in region 2.
 * @return A list containing the common species found in both regions.
 *
 * Note:
 * - Consider species names as strings.
 * - Ignore the case of species names (case-insensitive comparison).
 * - The order of species in the final list does not matter.
 * - If no common species are found, return an empty list ([]).
 */
fun findCommonSpecies(speciesList1: List<String>, speciesList2: List<String>): List<String> {

    val commonSpecies = mutableListOf<String>()  // Create an empty list to store common species

    for (species1 in speciesList1) {
        for (species2 in speciesList2) {
            if (species1.equals(species2, ignoreCase = true)) {
                commonSpecies.add(species1)  // Add the common species to the list
            }
        }
    }

    return commonSpecies
}