/**
 * Given two libraries as sets of book titles, this function returns a set of books
 * that are common to both libraries.
 *
 * @param library1 a set of book titles in library 1
 * @param library2 a set of book titles in library 2
 * @return a set of book titles that exist in both libraries
 */
fun findCommonBooks(library1: Set<String>, library2: Set<String>): Set<String> {

    val commonBooks = mutableSetOf<String>()

    // Iterate over each book title in library 1
    for (book1 in library1) {
        // Iterate over each book title in library 2
        for (book2 in library2) {
            // Check if the book title exists in both libraries
            if (book1 == book2) {
                // Add the common book title to the set
                commonBooks.add(book1)
            }
        }
    }

    return commonBooks
}
/**
 * Given two libraries as sets of book titles, this function returns a set of books
 * that are common to both libraries.
 *
 * @param library1 a set of book titles in library 1
 * @param library2 a set of book titles in library 2
 * @return a set of book titles that exist in both libraries
 */
fun findCommonBooks(library1: Set<String>, library2: Set<String>): Set<String> {
/**
 * Given two libraries as sets of book titles, this function returns a set of books
 * that are common to both libraries.
 *
 * @param library1 a set of book titles in library 1
 * @param library2 a set of book titles in library 2
 * @return a set of book titles that exist in both libraries
 */
fun findCommonBooks(library1: Set<String>, library2: Set<String>): Set<String> {

    val commonBooks = mutableSetOf<String>()

    // Iterate over each book title in library 1
    for (book1 in library1) {
        // Iterate over each book title in library 2
        for (book2 in library2) {
            // Check if the book title exists in both libraries
            if (book1 == book2) {
                // Add the common book title to the set
                commonBooks.add(book1)
            }
        }
    }

    return commonBooks
}