/**
 * This function takes in two dictionaries - 'clients' and 'locations', where 'clients' stores the name of the clients
 * as keys and their respective location as values, and 'locations' stores the name of the locations as keys and the
 * list of clients present in each location as values. It then returns a dictionary where the keys are the clients'
 * names and the values are the locations they are present in.
 *
 * @param clients A dictionary with client names and their locations
 * @param locations A dictionary with locations and the clients present in each location
 * @return A dictionary mapping client names to their respective locations
 */
fun findLocation(clients: Map<String, String>, locations: Map<String, List<String>>): Map<String, List<String>> {

    val clientLocation = mutableMapOf<String, List<String>>()

    for (client in clients.keys) {
        // Initializing a variable to store the common locations
        val commonLocations = mutableListOf<String>()

        // Iterating over the locations
        for (location in locations.keys) {
            if (client in locations[location]!!) {
                // The client is present in the current location
                commonLocations.add(location)
            }
        }

        // Storing the client and their respective common locations in the resultant dictionary
        clientLocation[client] = commonLocations
    }

    return clientLocation
}
/**
 * This function takes in two dictionaries - 'clients' and 'locations', where 'clients' stores the name of the clients
 * as keys and their respective location as values, and 'locations' stores the name of the locations as keys and the
 * list of clients present in each location as values. It then returns a dictionary where the keys are the clients'
 * names and the values are the locations they are present in.
 *
 * @param clients A dictionary with client names and their locations
 * @param locations A dictionary with locations and the clients present in each location
 * @return A dictionary mapping client names to their respective locations
 */
fun findLocation(clients: Map<String, String>, locations: Map<String, List<String>>): Map<String, List<String>> {
/**
 * This function takes in two dictionaries - 'clients' and 'locations', where 'clients' stores the name of the clients
 * as keys and their respective location as values, and 'locations' stores the name of the locations as keys and the
 * list of clients present in each location as values. It then returns a dictionary where the keys are the clients'
 * names and the values are the locations they are present in.
 *
 * @param clients A dictionary with client names and their locations
 * @param locations A dictionary with locations and the clients present in each location
 * @return A dictionary mapping client names to their respective locations
 */
fun findLocation(clients: Map<String, String>, locations: Map<String, List<String>>): Map<String, List<String>> {

    val clientLocation = mutableMapOf<String, List<String>>()

    for (client in clients.keys) {
        // Initializing a variable to store the common locations
        val commonLocations = mutableListOf<String>()

        // Iterating over the locations
        for (location in locations.keys) {
            if (client in locations[location]!!) {
                // The client is present in the current location
                commonLocations.add(location)
            }
        }

        // Storing the client and their respective common locations in the resultant dictionary
        clientLocation[client] = commonLocations
    }

    return clientLocation
}