/**
 * Given a dictionary of court records and a keyword, return a list of case files
 * that contain the keyword.
 *
 * @param courtRecords A dictionary where the keys are case numbers (strings) and the values
 *                     are lists containing the names of the lawyers involved.
 * @param keyword The keyword to search for in the case files.
 * @return A list of case files (case numbers) that contain the keyword.
 *
 * Example:
 * courtRecords = mapOf("C123" to listOf("John", "Jane"), "C456" to listOf("Jane", "Mark"), "C789" to listOf("John"))
 * keyword = "John"
 * searchCaseFiles(courtRecords, keyword) => ["C123", "C789"]
 */
fun searchCaseFiles(courtRecords: Map<String, List<String>>, keyword: String): List<String> {

    val result = mutableListOf<String>()

    // Loop through each case number and its corresponding lawyer names
    for ((case, lawyers) in courtRecords) {
        // Check if the keyword is present in any lawyer's name
        if (lawyers.any { it.toLowerCase() == keyword.toLowerCase() }) {
            result.add(case)
        }
    }

    return result
}
/**
 * Given a dictionary of court records and a keyword, return a list of case files
 * that contain the keyword.
 *
 * @param courtRecords A dictionary where the keys are case numbers (strings) and the values
 *                     are lists containing the names of the lawyers involved.
 * @param keyword The keyword to search for in the case files.
 * @return A list of case files (case numbers) that contain the keyword.
 *
 * Example:
 * courtRecords = mapOf("C123" to listOf("John", "Jane"), "C456" to listOf("Jane", "Mark"), "C789" to listOf("John"))
 * keyword = "John"
 * searchCaseFiles(courtRecords, keyword) => ["C123", "C789"]
 */
fun searchCaseFiles(courtRecords: Map<String, List<String>>, keyword: String): List<String> {
/**
 * Given a dictionary of court records and a keyword, return a list of case files
 * that contain the keyword.
 *
 * @param courtRecords A dictionary where the keys are case numbers (strings) and the values
 *                     are lists containing the names of the lawyers involved.
 * @param keyword The keyword to search for in the case files.
 * @return A list of case files (case numbers) that contain the keyword.
 *
 * Example:
 * courtRecords = mapOf("C123" to listOf("John", "Jane"), "C456" to listOf("Jane", "Mark"), "C789" to listOf("John"))
 * keyword = "John"
 * searchCaseFiles(courtRecords, keyword) => ["C123", "C789"]
 */
fun searchCaseFiles(courtRecords: Map<String, List<String>>, keyword: String): List<String> {

    val result = mutableListOf<String>()

    // Loop through each case number and its corresponding lawyer names
    for ((case, lawyers) in courtRecords) {
        // Check if the keyword is present in any lawyer's name
        if (lawyers.any { it.toLowerCase() == keyword.toLowerCase() }) {
            result.add(case)
        }
    }

    return result
}