/**
 * You are a librarian trying to find the books that are in stock from a given list of books and their availability.
 * The booksList parameter contains a list of books, where each book is represented as a string.
 * The availableBooks parameter contains a list of books that are currently available in the library.
 *
 * Your task is to return a new list containing the books that are both present in the booksList and availableBooks.
 *
 * Example:
 * ----------
 * booksList = ["Book A", "Book B", "Book C", "Book D", "Book E"]
 * availableBooks = ["Book D", "Book E", "Book F"]
 *
 * Expected Output:
 * ----------
 * ["Book D", "Book E"]
 */
fun findBooksInStock(booksList: List<String>, availableBooks: List<String>): List<String> {

    // Use filter to find the intersection of booksList and availableBooks
    val inStockBooks = booksList.filter { it in availableBooks }
    
    return inStockBooks
}
/**
 * You are a librarian trying to find the books that are in stock from a given list of books and their availability.
 * The booksList parameter contains a list of books, where each book is represented as a string.
 * The availableBooks parameter contains a list of books that are currently available in the library.
 *
 * Your task is to return a new list containing the books that are both present in the booksList and availableBooks.
 *
 * Example:
 * ----------
 * booksList = ["Book A", "Book B", "Book C", "Book D", "Book E"]
 * availableBooks = ["Book D", "Book E", "Book F"]
 *
 * Expected Output:
 * ----------
 * ["Book D", "Book E"]
 */
fun findBooksInStock(booksList: List<String>, availableBooks: List<String>): List<String> {
/**
 * You are a librarian trying to find the books that are in stock from a given list of books and their availability.
 * The booksList parameter contains a list of books, where each book is represented as a string.
 * The availableBooks parameter contains a list of books that are currently available in the library.
 *
 * Your task is to return a new list containing the books that are both present in the booksList and availableBooks.
 *
 * Example:
 * ----------
 * booksList = ["Book A", "Book B", "Book C", "Book D", "Book E"]
 * availableBooks = ["Book D", "Book E", "Book F"]
 *
 * Expected Output:
 * ----------
 * ["Book D", "Book E"]
 */
fun findBooksInStock(booksList: List<String>, availableBooks: List<String>): List<String> {

    // Use filter to find the intersection of booksList and availableBooks
    val inStockBooks = booksList.filter { it in availableBooks }
    
    return inStockBooks
}