/**
 * This function takes in the marketing data and the updated data, and performs the following tasks:
 * 1. Updates the marketing data with the updated data.
 * 2. Indexes the updated marketing data for quick access.
 *
 * @param marketingData The current marketing data.
 * @param updatedData The updated marketing data.
 * @return The updated and indexed marketing data.
 */
fun updateAndIndex(marketingData: MutableMap<String, String>, updatedData: Map<String, String>): Map<String, String> {

    // Update the marketing data with the updated data
    marketingData.putAll(updatedData)

    // Index the updated marketing data
    val indexedData = marketingData.mapKeys { it.key.toLowerCase() }

    return indexedData
}

// Given marketing data
val marketingData = mutableMapOf(
    "customer1" to "John",
    "customer2" to "Emma",
    "customer3" to "Michael",
    "customer4" to "Olivia",
    "customer5" to "Sophia"
)

// Updated marketing data
val updatedData = mapOf(
    "customer6" to "James",
    "customer7" to "Isabella",
    "customer8" to "Daniel"
)

// Call the function to update and index the
val updatedAndIndexedData = updateAndIndex(marketingData, updatedData)
/**
 * This function takes in the marketing data and the updated data, and performs the following tasks:
 * 1. Updates the marketing data with the updated data.
 * 2. Indexes the updated marketing data for quick access.
 *
 * @param marketingData The current marketing data.
 * @param updatedData The updated marketing data.
 * @return The updated and indexed marketing data.
 */
fun updateAndIndex(marketingData: MutableMap<String, String>, updatedData: Map<String, String>): Map<String, String> {
/**
 * This function takes in the marketing data and the updated data, and performs the following tasks:
 * 1. Updates the marketing data with the updated data.
 * 2. Indexes the updated marketing data for quick access.
 *
 * @param marketingData The current marketing data.
 * @param updatedData The updated marketing data.
 * @return The updated and indexed marketing data.
 */
fun updateAndIndex(marketingData: MutableMap<String, String>, updatedData: Map<String, String>): Map<String, String> {

    // Update the marketing data with the updated data
    marketingData.putAll(updatedData)

    // Index the updated marketing data
    val indexedData = marketingData.mapKeys { it.key.toLowerCase() }

    return indexedData
}

// Given marketing data
val marketingData = mutableMapOf(
    "customer1" to "John",
    "customer2" to "Emma",
    "customer3" to "Michael",
    "customer4" to "Olivia",
    "customer5" to "Sophia"
)

// Updated marketing data
val updatedData = mapOf(
    "customer6" to "James",
    "customer7" to "Isabella",
    "customer8" to "Daniel"
)

// Call the function to update and index the
val updatedAndIndexedData = updateAndIndex(marketingData, updatedData)