/**
 * Given a list of economists and a specific economist's name, this function finds the intersection between the economist's name
 * and the characters in common with the other economists' names using a loop control structure and the range function.
 *
 * @param economistList A list of economists' names
 * @param economistName The name of a specific economist
 * @return A set containing the characters in common between the specific economist's name and the other economists' names
 */
fun intersectionLoopRange(economistList: List<String>, economistName: String): Set<Char> {

    val commonCharacters = mutableSetOf<Char>()

    for (name in economistList) {
        if (name == economistName) {
            continue
        } else {
            for (i in economistName.indices) {
                for (j in name.indices) {
                    if (economistName[i] == name[j]) {
                        commonCharacters.add(economistName[i])
                    }
                }
            }
        }
    }

    return commonCharacters
}
/**
 * Given a list of economists and a specific economist's name, this function finds the intersection between the economist's name
 * and the characters in common with the other economists' names using a loop control structure and the range function.
 *
 * @param economistList A list of economists' names
 * @param economistName The name of a specific economist
 * @return A set containing the characters in common between the specific economist's name and the other economists' names
 */
fun intersectionLoopRange(economistList: List<String>, economistName: String): Set<Char> {
/**
 * Given a list of economists and a specific economist's name, this function finds the intersection between the economist's name
 * and the characters in common with the other economists' names using a loop control structure and the range function.
 *
 * @param economistList A list of economists' names
 * @param economistName The name of a specific economist
 * @return A set containing the characters in common between the specific economist's name and the other economists' names
 */
fun intersectionLoopRange(economistList: List<String>, economistName: String): Set<Char> {

    val commonCharacters = mutableSetOf<Char>()

    for (name in economistList) {
        if (name == economistName) {
            continue
        } else {
            for (i in economistName.indices) {
                for (j in name.indices) {
                    if (economistName[i] == name[j]) {
                        commonCharacters.add(economistName[i])
                    }
                }
            }
        }
    }

    return commonCharacters
}