/**
 * This exercise focuses on using the left shift operator and modifying lists with loops.
 * The function takes a list of books and the number of shifts. It performs left shifts on each book title
 * based on the number of shifts provided and returns the modified list of books.
 *
 * @param books a list of book titles (e.g., ["Book A", "Book B", "Book C", "Book D"])
 * @param numShifts an integer representing the number of left shifts to perform on each book title
 * @return modifiedBooks a list of book titles with each title left-shifted based on the numShifts
 *
 * Example:
 * modifyBooks(["Harry Potter", "Lord of the Rings", "The Hobbit"], 2) =>
 * ["rry PotterHa", "rd of the RingsLo", "e HobbitTh"]
 */
fun modifyBooks(books: List<String>, numShifts: Int): List<String> {

    val modifiedBooks = mutableListOf<String>()
    for (book in books) {
        var modifiedTitle = ""
        for (i in 0 until numShifts) {
            modifiedTitle += book.takeLast(1)
            modifiedTitle += book.dropLast(1)
        }
        modifiedBooks.add(modifiedTitle)
    }
    return modifiedBooks
}
/**
 * This exercise focuses on using the left shift operator and modifying lists with loops.
 * The function takes a list of books and the number of shifts. It performs left shifts on each book title
 * based on the number of shifts provided and returns the modified list of books.
 *
 * @param books a list of book titles (e.g., ["Book A", "Book B", "Book C", "Book D"])
 * @param numShifts an integer representing the number of left shifts to perform on each book title
 * @return modifiedBooks a list of book titles with each title left-shifted based on the numShifts
 *
 * Example:
 * modifyBooks(["Harry Potter", "Lord of the Rings", "The Hobbit"], 2) =>
 * ["rry PotterHa", "rd of the RingsLo", "e HobbitTh"]
 */
fun modifyBooks(books: List<String>, numShifts: Int): List<String> {
/**
 * This exercise focuses on using the left shift operator and modifying lists with loops.
 * The function takes a list of books and the number of shifts. It performs left shifts on each book title
 * based on the number of shifts provided and returns the modified list of books.
 *
 * @param books a list of book titles (e.g., ["Book A", "Book B", "Book C", "Book D"])
 * @param numShifts an integer representing the number of left shifts to perform on each book title
 * @return modifiedBooks a list of book titles with each title left-shifted based on the numShifts
 *
 * Example:
 * modifyBooks(["Harry Potter", "Lord of the Rings", "The Hobbit"], 2) =>
 * ["rry PotterHa", "rd of the RingsLo", "e HobbitTh"]
 */
fun modifyBooks(books: List<String>, numShifts: Int): List<String> {

    val modifiedBooks = mutableListOf<String>()
    for (book in books) {
        var modifiedTitle = ""
        for (i in 0 until numShifts) {
            modifiedTitle += book.takeLast(1)
            modifiedTitle += book.dropLast(1)
        }
        modifiedBooks.add(modifiedTitle)
    }
    return modifiedBooks
}