/**
 * Librarian needs to find books that are present in both library1 and library2.
 * Each library is represented as a set of book titles.
 * Return a set of book titles that are common to both libraries.
 *
 * @param library1 Set of book titles in library1
 * @param library2 Set of book titles in library2
 * @return Set of book titles that are present in both library1 and library2
 */
fun findBooksInCommon(library1: Set<String>, library2: Set<String>): Set<String> {

    val booksInCommon = mutableSetOf<String>()

    // Iterate through each book in library1
    for (book1 in library1) {
        // Iterate through each book in library2
        for (book2 in library2) {
            // This condition will be triggered when a book is found in both libraries
            if (book1 == book2) {
                // Add the book title to the resulting set
                booksInCommon.add(book1)
            }
        }
    }

    return booksInCommon
}
/**
 * Librarian needs to find books that are present in both library1 and library2.
 * Each library is represented as a set of book titles.
 * Return a set of book titles that are common to both libraries.
 *
 * @param library1 Set of book titles in library1
 * @param library2 Set of book titles in library2
 * @return Set of book titles that are present in both library1 and library2
 */
fun findBooksInCommon(library1: Set<String>, library2: Set<String>): Set<String> {
/**
 * Librarian needs to find books that are present in both library1 and library2.
 * Each library is represented as a set of book titles.
 * Return a set of book titles that are common to both libraries.
 *
 * @param library1 Set of book titles in library1
 * @param library2 Set of book titles in library2
 * @return Set of book titles that are present in both library1 and library2
 */
fun findBooksInCommon(library1: Set<String>, library2: Set<String>): Set<String> {

    val booksInCommon = mutableSetOf<String>()

    // Iterate through each book in library1
    for (book1 in library1) {
        // Iterate through each book in library2
        for (book2 in library2) {
            // This condition will be triggered when a book is found in both libraries
            if (book1 == book2) {
                // Add the book title to the resulting set
                booksInCommon.add(book1)
            }
        }
    }

    return booksInCommon
}