/**
 * A librarian needs to find the books that are both available and requested.
 *
 * @param librarian The name of the librarian.
 * @param availableBooks A set of available books.
 * @param requestedBooks A set of requested books.
 * @return A set containing the books that are both available and requested.
 */
fun findBooks(librarian: String, availableBooks: Set<String>, requestedBooks: Set<String>): Set<String> {

    // Initialize an empty set to store the books that match the criteria
    val matchingBooks = mutableSetOf<String>()

    // Loop through each available book
    for (book in availableBooks) {
        // Check if the book is also in the set of requested books
        if (book in requestedBooks) {
            // Add the book to the set of matching books
            matchingBooks.add(book)

            // Display a message about the found book
            println("$librarian found '$book' which is both available and requested.")
        }
    }

    // Check if no matching books were found
    if (matchingBooks.isEmpty()) {
        // Display a message indicating no matching books were found
        println("$librarian couldn't find any books that are both available and requested.")
    }

    return matchingBooks
}
/**
 * A librarian needs to find the books that are both available and requested.
 *
 * @param librarian The name of the librarian.
 * @param availableBooks A set of available books.
 * @param requestedBooks A set of requested books.
 * @return A set containing the books that are both available and requested.
 */
fun findBooks(librarian: String, availableBooks: Set<String>, requestedBooks: Set<String>): Set<String> {
/**
 * A librarian needs to find the books that are both available and requested.
 *
 * @param librarian The name of the librarian.
 * @param availableBooks A set of available books.
 * @param requestedBooks A set of requested books.
 * @return A set containing the books that are both available and requested.
 */
fun findBooks(librarian: String, availableBooks: Set<String>, requestedBooks: Set<String>): Set<String> {

    // Initialize an empty set to store the books that match the criteria
    val matchingBooks = mutableSetOf<String>()

    // Loop through each available book
    for (book in availableBooks) {
        // Check if the book is also in the set of requested books
        if (book in requestedBooks) {
            // Add the book to the set of matching books
            matchingBooks.add(book)

            // Display a message about the found book
            println("$librarian found '$book' which is both available and requested.")
        }
    }

    // Check if no matching books were found
    if (matchingBooks.isEmpty()) {
        // Display a message indicating no matching books were found
        println("$librarian couldn't find any books that are both available and requested.")
    }

    return matchingBooks
}