/**
 * Given a dictionary of musicians and their genres, find the list of musicians who play both genre1 and genre2.
 *
 * @param musicians A dictionary where the keys are musician names (strings) and the values are lists of genres played by each musician.
 * @param genre1 The first genre to search for.
 * @param genre2 The second genre to search for.
 * @return A list of musician names who play both genre1 and genre2.
 */
fun findCommonGenres(musicians: Map<String, List<String>>, genre1: String, genre2: String): List<String> {

    val commonMusicians = mutableListOf<String>()

    // Iterate through each musician in the dictionary
    for ((musician, genres) in musicians) {
        // Check if both genres are in the musician's list of genres
        if (genre1 in genres && genre2 in genres) {
            commonMusicians.add(musician)
        }
    }

    return commonMusicians
}
/**
 * Given a dictionary of musicians and their genres, find the list of musicians who play both genre1 and genre2.
 *
 * @param musicians A dictionary where the keys are musician names (strings) and the values are lists of genres played by each musician.
 * @param genre1 The first genre to search for.
 * @param genre2 The second genre to search for.
 * @return A list of musician names who play both genre1 and genre2.
 */
fun findCommonGenres(musicians: Map<String, List<String>>, genre1: String, genre2: String): List<String> {
/**
 * Given a dictionary of musicians and their genres, find the list of musicians who play both genre1 and genre2.
 *
 * @param musicians A dictionary where the keys are musician names (strings) and the values are lists of genres played by each musician.
 * @param genre1 The first genre to search for.
 * @param genre2 The second genre to search for.
 * @return A list of musician names who play both genre1 and genre2.
 */
fun findCommonGenres(musicians: Map<String, List<String>>, genre1: String, genre2: String): List<String> {

    val commonMusicians = mutableListOf<String>()

    // Iterate through each musician in the dictionary
    for ((musician, genres) in musicians) {
        // Check if both genres are in the musician's list of genres
        if (genre1 in genres && genre2 in genres) {
            commonMusicians.add(musician)
        }
    }

    return commonMusicians
}