/**
 * Given a list of books, the function checks if there are any available books.
 * If there are no available books, the function continues to the next librarian.
 */
fun checkAvailableBooks(books: List<Map<String, Any>>): String {

    val librarianNames = listOf("Lucy", "Daniel", "Sarah")
    var currentLibrarian = ""

    for (librarian in librarianNames) {
        if (books.isNotEmpty()) {
            val availableBooks = books.filter { it["available"] as Boolean }
            if (availableBooks.isNotEmpty()) {
                currentLibrarian = librarian
                break
            }
        } else {
            // Continue to the next librarian if there are no books
            continue
        }
    }

    return currentLibrarian
}
/**
 * Given a list of books, the function checks if there are any available books.
 * If there are no available books, the function continues to the next librarian.
 */
fun checkAvailableBooks(books: List<Map<String, Any>>): String {
/**
 * Given a list of books, the function checks if there are any available books.
 * If there are no available books, the function continues to the next librarian.
 */
fun checkAvailableBooks(books: List<Map<String, Any>>): String {

    val librarianNames = listOf("Lucy", "Daniel", "Sarah")
    var currentLibrarian = ""

    for (librarian in librarianNames) {
        if (books.isNotEmpty()) {
            val availableBooks = books.filter { it["available"] as Boolean }
            if (availableBooks.isNotEmpty()) {
                currentLibrarian = librarian
                break
            }
        } else {
            // Continue to the next librarian if there are no books
            continue
        }
    }

    return currentLibrarian
}