/**
 * Takes in a list of nurse data and returns the most common career among them.
 *
 * @param nurseData A list of nurse data.
 * @return A Pair containing the most common career and its frequency.
 */
fun getMostCommonCareer(nurseData: List<List<String>>): Pair<String?, Int> {

    // Use list comprehension to extract careers from the nurse data list
    val careers = nurseData.map { it[2] }

    // Use distinct to get a sublist of unique careers
    val uniqueCareers = careers.distinct()

    // Initialize variables to hold the most common career and its count
    var mostCommonCareer: String? = null
    var maxCount = 0

    // Iterate over unique careers to determine the most common one
    for (career in uniqueCareers) {
        // Count the frequency of the current career
        val count = careers.count { it == career }

        // Update the most common career if a new maximum count is found
        if (count > maxCount) {
            mostCommonCareer = career
            maxCount = count
        }
    }

    // Return a Pair containing the most common career and its frequency
    return Pair(mostCommonCareer, maxCount)
}
/**
 * Takes in a list of nurse data and returns the most common career among them.
 *
 * @param nurseData A list of nurse data.
 * @return A Pair containing the most common career and its frequency.
 */
fun getMostCommonCareer(nurseData: List<List<String>>): Pair<String?, Int> {
/**
 * Takes in a list of nurse data and returns the most common career among them.
 *
 * @param nurseData A list of nurse data.
 * @return A Pair containing the most common career and its frequency.
 */
fun getMostCommonCareer(nurseData: List<List<String>>): Pair<String?, Int> {

    // Use list comprehension to extract careers from the nurse data list
    val careers = nurseData.map { it[2] }

    // Use distinct to get a sublist of unique careers
    val uniqueCareers = careers.distinct()

    // Initialize variables to hold the most common career and its count
    var mostCommonCareer: String? = null
    var maxCount = 0

    // Iterate over unique careers to determine the most common one
    for (career in uniqueCareers) {
        // Count the frequency of the current career
        val count = careers.count { it == career }

        // Update the most common career if a new maximum count is found
        if (count > maxCount) {
            mostCommonCareer = career
            maxCount = count
        }
    }

    // Return a Pair containing the most common career and its frequency
    return Pair(mostCommonCareer, maxCount)
}