/**
 * This function searches for books in the library based on the given parameters and returns the matching books.
 *
 * @param library A map representing the library with books as keys and their details as values.
 * @param title The title of the book to search for.
 * @param author The author of the book to search for.
 * @param genre The genre of the book to search for.
 * @return A list of matching books found in the library.
 */
fun searchBooks(library: Map<String, Triple<String, String, String>>, title: String, author: String, genre: String): List<String> {

    val matchingBooks = mutableListOf<String>()
    for ((book, details) in library) {
        val (bookTitle, bookAuthor, bookGenre) = details
        if (bookTitle == title && bookAuthor == author && bookGenre == genre) {
            matchingBooks.add(book)
        }
    }
    return matchingBooks
}

// Example usage:
val library = mapOf(
    "Book1" to Triple("Title1", "Author1", "Genre1"),
    "Book2" to Triple("Title2", "Author2", "Genre2"),
    "Book3" to Triple("Title3", "Author1", "Genre3"),
    "Book4" to Triple("Title1", "Author4", "Genre4")
)
/**
 * This function searches for books in the library based on the given parameters and returns the matching books.
 *
 * @param library A map representing the library with books as keys and their details as values.
 * @param title The title of the book to search for.
 * @param author The author of the book to search for.
 * @param genre The genre of the book to search for.
 * @return A list of matching books found in the library.
 */
fun searchBooks(library: Map<String, Triple<String, String, String>>, title: String, author: String, genre: String): List<String> {
/**
 * This function searches for books in the library based on the given parameters and returns the matching books.
 *
 * @param library A map representing the library with books as keys and their details as values.
 * @param title The title of the book to search for.
 * @param author The author of the book to search for.
 * @param genre The genre of the book to search for.
 * @return A list of matching books found in the library.
 */
fun searchBooks(library: Map<String, Triple<String, String, String>>, title: String, author: String, genre: String): List<String> {

    val matchingBooks = mutableListOf<String>()
    for ((book, details) in library) {
        val (bookTitle, bookAuthor, bookGenre) = details
        if (bookTitle == title && bookAuthor == author && bookGenre == genre) {
            matchingBooks.add(book)
        }
    }
    return matchingBooks
}

// Example usage:
val library = mapOf(
    "Book1" to Triple("Title1", "Author1", "Genre1"),
    "Book2" to Triple("Title2", "Author2", "Genre2"),
    "Book3" to Triple("Title3", "Author1", "Genre3"),
    "Book4" to Triple("Title1", "Author4", "Genre4")
)