/**
 * The function takes a list (library) containing information about books present in a library
 * and a string (bookName) representing the name of the book to search for. It returns a list
 * containing the positions (indices) of the occurrences of the book in the library.
 *
 * @param library A list containing book names (strings) present in the library.
 * @param bookName The name of the book to search for.
 * @return A list containing the positions (indices) of the occurrences of the book in the library.
 *
 * Example:
 * findBooksInLibrary(listOf("Harry Potter", "The Lord of the Rings", "Game of Thrones",
 * "Harry Potter", "The Da Vinci Code", "Harry Potter", "Harry Potter"), "Harry Potter")
 * > [0, 3, 5, 6]
 */
fun findBooksInLibrary(library: List<String>, bookName: String): List<Int> {

    val positions = mutableListOf<Int>()
    for (i in library.indices) {
        if (library[i] == bookName) {
            positions.add(i)
        }
    }
    return positions
}
/**
 * The function takes a list (library) containing information about books present in a library
 * and a string (bookName) representing the name of the book to search for. It returns a list
 * containing the positions (indices) of the occurrences of the book in the library.
 *
 * @param library A list containing book names (strings) present in the library.
 * @param bookName The name of the book to search for.
 * @return A list containing the positions (indices) of the occurrences of the book in the library.
 *
 * Example:
 * findBooksInLibrary(listOf("Harry Potter", "The Lord of the Rings", "Game of Thrones",
 * "Harry Potter", "The Da Vinci Code", "Harry Potter", "Harry Potter"), "Harry Potter")
 * > [0, 3, 5, 6]
 */
fun findBooksInLibrary(library: List<String>, bookName: String): List<Int> {
/**
 * The function takes a list (library) containing information about books present in a library
 * and a string (bookName) representing the name of the book to search for. It returns a list
 * containing the positions (indices) of the occurrences of the book in the library.
 *
 * @param library A list containing book names (strings) present in the library.
 * @param bookName The name of the book to search for.
 * @return A list containing the positions (indices) of the occurrences of the book in the library.
 *
 * Example:
 * findBooksInLibrary(listOf("Harry Potter", "The Lord of the Rings", "Game of Thrones",
 * "Harry Potter", "The Da Vinci Code", "Harry Potter", "Harry Potter"), "Harry Potter")
 * > [0, 3, 5, 6]
 */
fun findBooksInLibrary(library: List<String>, bookName: String): List<Int> {

    val positions = mutableListOf<Int>()
    for (i in library.indices) {
        if (library[i] == bookName) {
            positions.add(i)
        }
    }
    return positions
}