/**
 * The librarian wants to remove the books that have been checked out from the library catalog.
 *
 * Your task is to complete the function 'removeCheckedOutBooks' which takes two arguments:
 * - 'libraryCatalog' (MutableList): A list of books available in the library catalog.
 * - 'checkedOutBooks' (List): A list of books that have been checked out from the library.
 *
 * The function should remove the checked out books from the library catalog and return the updated catalog.
 * Note that some books may appear multiple times in the library catalog list and some checked out books
 * may not be in the catalog.
 *
 * Example:
 * libraryCatalog = mutableListOf("Harry Potter", "The Great Gatsby", "To Kill a Mockingbird", "Harry Potter")
 * checkedOutBooks = listOf("The Great Gatsby", "Harry Potter", "The Catcher in the Rye")
 *
 * removeCheckedOutBooks(libraryCatalog, checkedOutBooks) should return:
 * ["To Kill a Mockingbird"]
 */
fun removeCheckedOutBooks(libraryCatalog: MutableList<String>, checkedOutBooks: List<String>): List<String> {

    for (book in checkedOutBooks) {
        while (book in libraryCatalog) {
            libraryCatalog.remove(book)
        }
    }
    return libraryCatalog
}
/**
 * The librarian wants to remove the books that have been checked out from the library catalog.
 *
 * Your task is to complete the function 'removeCheckedOutBooks' which takes two arguments:
 * - 'libraryCatalog' (MutableList): A list of books available in the library catalog.
 * - 'checkedOutBooks' (List): A list of books that have been checked out from the library.
 *
 * The function should remove the checked out books from the library catalog and return the updated catalog.
 * Note that some books may appear multiple times in the library catalog list and some checked out books
 * may not be in the catalog.
 *
 * Example:
 * libraryCatalog = mutableListOf("Harry Potter", "The Great Gatsby", "To Kill a Mockingbird", "Harry Potter")
 * checkedOutBooks = listOf("The Great Gatsby", "Harry Potter", "The Catcher in the Rye")
 *
 * removeCheckedOutBooks(libraryCatalog, checkedOutBooks) should return:
 * ["To Kill a Mockingbird"]
 */
fun removeCheckedOutBooks(libraryCatalog: MutableList<String>, checkedOutBooks: List<String>): List<String> {
/**
 * The librarian wants to remove the books that have been checked out from the library catalog.
 *
 * Your task is to complete the function 'removeCheckedOutBooks' which takes two arguments:
 * - 'libraryCatalog' (MutableList): A list of books available in the library catalog.
 * - 'checkedOutBooks' (List): A list of books that have been checked out from the library.
 *
 * The function should remove the checked out books from the library catalog and return the updated catalog.
 * Note that some books may appear multiple times in the library catalog list and some checked out books
 * may not be in the catalog.
 *
 * Example:
 * libraryCatalog = mutableListOf("Harry Potter", "The Great Gatsby", "To Kill a Mockingbird", "Harry Potter")
 * checkedOutBooks = listOf("The Great Gatsby", "Harry Potter", "The Catcher in the Rye")
 *
 * removeCheckedOutBooks(libraryCatalog, checkedOutBooks) should return:
 * ["To Kill a Mockingbird"]
 */
fun removeCheckedOutBooks(libraryCatalog: MutableList<String>, checkedOutBooks: List<String>): List<String> {

    for (book in checkedOutBooks) {
        while (book in libraryCatalog) {
            libraryCatalog.remove(book)
        }
    }
    return libraryCatalog
}