/**
 * Given a list of names representing the custody of pets and a map where the keys are pets and the values are the pet's owner,
 * find the names of the owners who have the custody of all the pets in the provided list.
 *
 * @param names A list of strings representing the pets' names.
 * @param pets A map where the keys are the pets' names (strings) and the values are the pets' owners (strings).
 * @return A list of strings representing the names of the owners who have the custody of all the pets in the given list.
 */
fun findCustody(names: List<String>, pets: Map<String, String>): List<String> {

    val custodyOwners = mutableListOf<String>()
    for (name in names) {
        var allCustody = true
        for ((pet, owner) in pets) {
            if (name != owner) {
                allCustody = false
                break
            }
        }
        if (allCustody) {
            custodyOwners.add(name)
        }
    }
    return custodyOwners
}
/**
 * Given a list of names representing the custody of pets and a map where the keys are pets and the values are the pet's owner,
 * find the names of the owners who have the custody of all the pets in the provided list.
 *
 * @param names A list of strings representing the pets' names.
 * @param pets A map where the keys are the pets' names (strings) and the values are the pets' owners (strings).
 * @return A list of strings representing the names of the owners who have the custody of all the pets in the given list.
 */
fun findCustody(names: List<String>, pets: Map<String, String>): List<String> {
/**
 * Given a list of names representing the custody of pets and a map where the keys are pets and the values are the pet's owner,
 * find the names of the owners who have the custody of all the pets in the provided list.
 *
 * @param names A list of strings representing the pets' names.
 * @param pets A map where the keys are the pets' names (strings) and the values are the pets' owners (strings).
 * @return A list of strings representing the names of the owners who have the custody of all the pets in the given list.
 */
fun findCustody(names: List<String>, pets: Map<String, String>): List<String> {

    val custodyOwners = mutableListOf<String>()
    for (name in names) {
        var allCustody = true
        for ((pet, owner) in pets) {
            if (name != owner) {
                allCustody = false
                break
            }
        }
        if (allCustody) {
            custodyOwners.add(name)
        }
    }
    return custodyOwners
}