/**
 * Given a list of books and a list of patrons, find the books that are available to be borrowed.
 *
 * @param books A list of book titles and their current availability status
 * @param patrons A list of patron names who want to borrow books
 * @return A list of books that are available to be borrowed by any of the patrons
 */
fun findAvailableBooks(books: List<Pair<String, Boolean>>, patrons: List<String>): List<String> {

    val availableBooks = mutableListOf<String>()

    for (book in books) {
        val (bookTitle, availability) = book
        var isAvailable = true

        for (patron in patrons) {
            if (patron.toLowerCase() in bookTitle.toLowerCase()) {
                isAvailable = false
                break
            }
        }

        if (availability && isAvailable) {
            availableBooks.add(bookTitle)
        }
    }

    return availableBooks
}
/**
 * Given a list of books and a list of patrons, find the books that are available to be borrowed.
 *
 * @param books A list of book titles and their current availability status
 * @param patrons A list of patron names who want to borrow books
 * @return A list of books that are available to be borrowed by any of the patrons
 */
fun findAvailableBooks(books: List<Pair<String, Boolean>>, patrons: List<String>): List<String> {
/**
 * Given a list of books and a list of patrons, find the books that are available to be borrowed.
 *
 * @param books A list of book titles and their current availability status
 * @param patrons A list of patron names who want to borrow books
 * @return A list of books that are available to be borrowed by any of the patrons
 */
fun findAvailableBooks(books: List<Pair<String, Boolean>>, patrons: List<String>): List<String> {

    val availableBooks = mutableListOf<String>()

    for (book in books) {
        val (bookTitle, availability) = book
        var isAvailable = true

        for (patron in patrons) {
            if (patron.toLowerCase() in bookTitle.toLowerCase()) {
                isAvailable = false
                break
            }
        }

        if (availability && isAvailable) {
            availableBooks.add(bookTitle)
        }
    }

    return availableBooks
}