/**
 * In this exercise, you are a journalist who wants to create a dictionary that contains the concatenation of strings
 * for multiple people's names and ages. You need to complete the code to achieve this.
 *
 * @param names a list of strings representing people's names
 * @param ages a list of integers representing people's ages
 * @return A dictionary where each key is a person's name and the value is a string that concatenates the person's name and age.
 */
fun concatenateStrings(names: List<String>, ages: List<Int>): Map<String, String> {

    // Create an empty dictionary to store the concatenated strings
    val concatenatedDict = mutableMapOf<String, String>()

    // Check if the lengths of the names and ages lists are equal
    if (names.size != ages.size) {
        println("Error: The lengths of the names and ages lists are not equal.")
        return concatenatedDict
    }

    // Iterate through each name and age
    for (i in names.indices) {
        // Check if the current name is not already a key in concatenatedDict
        if (!concatenatedDict.containsKey(names[i])) {
            // Concatenate the name and age as a string
            val concatenatedString = "${names[i]}: ${ages[i]}"
            concatenatedDict[names[i]] = concatenatedString
        }
    }

    return concatenatedDict
}
/**
 * In this exercise, you are a journalist who wants to create a dictionary that contains the concatenation of strings
 * for multiple people's names and ages. You need to complete the code to achieve this.
 *
 * @param names a list of strings representing people's names
 * @param ages a list of integers representing people's ages
 * @return A dictionary where each key is a person's name and the value is a string that concatenates the person's name and age.
 */
fun concatenateStrings(names: List<String>, ages: List<Int>): Map<String, String> {
/**
 * In this exercise, you are a journalist who wants to create a dictionary that contains the concatenation of strings
 * for multiple people's names and ages. You need to complete the code to achieve this.
 *
 * @param names a list of strings representing people's names
 * @param ages a list of integers representing people's ages
 * @return A dictionary where each key is a person's name and the value is a string that concatenates the person's name and age.
 */
fun concatenateStrings(names: List<String>, ages: List<Int>): Map<String, String> {

    // Create an empty dictionary to store the concatenated strings
    val concatenatedDict = mutableMapOf<String, String>()

    // Check if the lengths of the names and ages lists are equal
    if (names.size != ages.size) {
        println("Error: The lengths of the names and ages lists are not equal.")
        return concatenatedDict
    }

    // Iterate through each name and age
    for (i in names.indices) {
        // Check if the current name is not already a key in concatenatedDict
        if (!concatenatedDict.containsKey(names[i])) {
            // Concatenate the name and age as a string
            val concatenatedString = "${names[i]}: ${ages[i]}"
            concatenatedDict[names[i]] = concatenatedString
        }
    }

    return concatenatedDict
}