/**
 * A zoologist wants to find the common species between two zoos.
 *
 * Given two lists zooA and zooB, your task is to find the species that exist in both sets.
 * The zoologist wants you to solve this problem without using any built-in set operations.
 *
 * @param zooA A list containing the species in zoo A.
 * @param zooB A list containing the species in zoo B.
 * @return A set containing the common species between zooA and zooB.
 */
fun findCommonSpecies(zooA: List<String>, zooB: List<String>): Set<String> {

    // Create a copy of zooA without any duplicate elements
    val uniqueSpeciesZooA = mutableListOf<String>()
    for (species in zooA) {
        if (species !in uniqueSpeciesZooA) {
            uniqueSpeciesZooA.add(species)
        }
    }

    // Create a set containing the common species
    val commonSpecies = mutableSetOf<String>()
    for (species in uniqueSpeciesZooA) {
        if (species in zooB) {
            commonSpecies.add(species)
        }
    }

    return commonSpecies
}
/**
 * A zoologist wants to find the common species between two zoos.
 *
 * Given two lists zooA and zooB, your task is to find the species that exist in both sets.
 * The zoologist wants you to solve this problem without using any built-in set operations.
 *
 * @param zooA A list containing the species in zoo A.
 * @param zooB A list containing the species in zoo B.
 * @return A set containing the common species between zooA and zooB.
 */
fun findCommonSpecies(zooA: List<String>, zooB: List<String>): Set<String> {
/**
 * A zoologist wants to find the common species between two zoos.
 *
 * Given two lists zooA and zooB, your task is to find the species that exist in both sets.
 * The zoologist wants you to solve this problem without using any built-in set operations.
 *
 * @param zooA A list containing the species in zoo A.
 * @param zooB A list containing the species in zoo B.
 * @return A set containing the common species between zooA and zooB.
 */
fun findCommonSpecies(zooA: List<String>, zooB: List<String>): Set<String> {

    // Create a copy of zooA without any duplicate elements
    val uniqueSpeciesZooA = mutableListOf<String>()
    for (species in zooA) {
        if (species !in uniqueSpeciesZooA) {
            uniqueSpeciesZooA.add(species)
        }
    }

    // Create a set containing the common species
    val commonSpecies = mutableSetOf<String>()
    for (species in uniqueSpeciesZooA) {
        if (species in zooB) {
            commonSpecies.add(species)
        }
    }

    return commonSpecies
}