/**
 * This exercise aims at manipulating a given string by executing a block of code multiple times.
 * The function "manipulateString" takes in a string 'text' and an integer 'n' as arguments, and returns a modified string.
 *
 * The exercise is to remove all occurrences of the character 'a' from the string 'text' using a loop, and then repeat this process 'n' times.
 * The modified string should be returned as the final output.
 *
 * Example:
 * manipulateString("banana", 3)
 * Output: "bnn"
 *
 * Explanation:
 * Iteration 1: "banana" -> "bnn"
 * Iteration 2: "bnn" -> "bn"
 * Iteration 3: "bn" -> "bn"
 *
 * Your task is to complete the code to solve this exercise.
 */
fun manipulateString(text: String, n: Int): String {

    var modifiedText = text
    repeat(n) {
        // Execute this block of code 'n' times
        modifiedText = modifiedText.filter { it != 'a' }
    }
    return modifiedText
}
/**
 * This exercise aims at manipulating a given string by executing a block of code multiple times.
 * The function "manipulateString" takes in a string 'text' and an integer 'n' as arguments, and returns a modified string.
 *
 * The exercise is to remove all occurrences of the character 'a' from the string 'text' using a loop, and then repeat this process 'n' times.
 * The modified string should be returned as the final output.
 *
 * Example:
 * manipulateString("banana", 3)
 * Output: "bnn"
 *
 * Explanation:
 * Iteration 1: "banana" -> "bnn"
 * Iteration 2: "bnn" -> "bn"
 * Iteration 3: "bn" -> "bn"
 *
 * Your task is to complete the code to solve this exercise.
 */
fun manipulateString(text: String, n: Int): String {
/**
 * This exercise aims at manipulating a given string by executing a block of code multiple times.
 * The function "manipulateString" takes in a string 'text' and an integer 'n' as arguments, and returns a modified string.
 *
 * The exercise is to remove all occurrences of the character 'a' from the string 'text' using a loop, and then repeat this process 'n' times.
 * The modified string should be returned as the final output.
 *
 * Example:
 * manipulateString("banana", 3)
 * Output: "bnn"
 *
 * Explanation:
 * Iteration 1: "banana" -> "bnn"
 * Iteration 2: "bnn" -> "bn"
 * Iteration 3: "bn" -> "bn"
 *
 * Your task is to complete the code to solve this exercise.
 */
fun manipulateString(text: String, n: Int): String {

    var modifiedText = text
    repeat(n) {
        // Execute this block of code 'n' times
        modifiedText = modifiedText.filter { it != 'a' }
    }
    return modifiedText
}