/**
 * This exercise is designed for Biologists to practice creating a tuple using parentheses and manipulating a string using loops.
 *
 * Given a species name in the format 'Genus species', your task is to create a tuple containing two elements: the genus and the species. The elements in the tuple should be in lowercase. You should exclude any leading or trailing whitespace from each element.
 *
 * Example:
 * input: ' Homo sapiens   '
 * output: ('homo', 'sapiens')
 */
fun createGenusSpeciesTuple(speciesName: String): Pair<String, String> {

    // Remove leading and trailing whitespace from the species name
    var speciesNameTrimmed = speciesName.trim()

    // Initialize two variables for genus and species
    var genus = ""
    var species = ""

    // Iterate through each character in the species name
    for (char in speciesNameTrimmed) {
        // Separate the genus and species based on the space character
        if (char == ' ') {
            genus = genus.toLowerCase()
        } else {
            species += char.toLowerCase()
        }
    }

    // Return the tuple containing the genus and species
    return Pair(genus, species)
}
/**
 * This exercise is designed for Biologists to practice creating a tuple using parentheses and manipulating a string using loops.
 *
 * Given a species name in the format 'Genus species', your task is to create a tuple containing two elements: the genus and the species. The elements in the tuple should be in lowercase. You should exclude any leading or trailing whitespace from each element.
 *
 * Example:
 * input: ' Homo sapiens   '
 * output: ('homo', 'sapiens')
 */
fun createGenusSpeciesTuple(speciesName: String): Pair<String, String> {
/**
 * This exercise is designed for Biologists to practice creating a tuple using parentheses and manipulating a string using loops.
 *
 * Given a species name in the format 'Genus species', your task is to create a tuple containing two elements: the genus and the species. The elements in the tuple should be in lowercase. You should exclude any leading or trailing whitespace from each element.
 *
 * Example:
 * input: ' Homo sapiens   '
 * output: ('homo', 'sapiens')
 */
fun createGenusSpeciesTuple(speciesName: String): Pair<String, String> {

    // Remove leading and trailing whitespace from the species name
    var speciesNameTrimmed = speciesName.trim()

    // Initialize two variables for genus and species
    var genus = ""
    var species = ""

    // Iterate through each character in the species name
    for (char in speciesNameTrimmed) {
        // Separate the genus and species based on the space character
        if (char == ' ') {
            genus = genus.toLowerCase()
        } else {
            species += char.toLowerCase()
        }
    }

    // Return the tuple containing the genus and species
    return Pair(genus, species)
}