/**
 * This exercise should help the Physical Therapist practice multiplying two arrays element-wise
 * and changing individual elements of an array.
 *
 * The task is to create a new array by multiplying two given arrays element-wise. Then, replace
 * the elements in the new array that are divisible by 3 with the string 'divisible'. Finally,
 * return the modified new array.
 *
 * @param arr1 A list of integers representing the first array.
 * @param arr2 A list of integers representing the second array.
 * @return A modified list where elements divisible by 3 are replaced with the string 'divisible'.
 */
fun multiplyAndChangeElements(arr1: List<Int>, arr2: List<Int>): List<Any> {

    // Initialize an empty list to store the result
    val result = mutableListOf<Any>()

    // Check if both arrays are of the same length
    if (arr1.size != arr2.size) {
        return listOf("Error: The input arrays should have the same length.")
    }

    // Iterate through the elements of the arrays
    for (i in arr1.indices) {
        // Multiply the elements of arr1 and arr2 at the same index
        val element = arr1[i] * arr2[i]
        // Check if the element is divisible by 3 and replace it with 'divisible'
        result.add(if (element % 3 == 0) "divisible" else element)
    }

    return result
}
/**
 * This exercise should help the Physical Therapist practice multiplying two arrays element-wise
 * and changing individual elements of an array.
 *
 * The task is to create a new array by multiplying two given arrays element-wise. Then, replace
 * the elements in the new array that are divisible by 3 with the string 'divisible'. Finally,
 * return the modified new array.
 *
 * @param arr1 A list of integers representing the first array.
 * @param arr2 A list of integers representing the second array.
 * @return A modified list where elements divisible by 3 are replaced with the string 'divisible'.
 */
fun multiplyAndChangeElements(arr1: List<Int>, arr2: List<Int>): List<Any> {
/**
 * This exercise should help the Physical Therapist practice multiplying two arrays element-wise
 * and changing individual elements of an array.
 *
 * The task is to create a new array by multiplying two given arrays element-wise. Then, replace
 * the elements in the new array that are divisible by 3 with the string 'divisible'. Finally,
 * return the modified new array.
 *
 * @param arr1 A list of integers representing the first array.
 * @param arr2 A list of integers representing the second array.
 * @return A modified list where elements divisible by 3 are replaced with the string 'divisible'.
 */
fun multiplyAndChangeElements(arr1: List<Int>, arr2: List<Int>): List<Any> {

    // Initialize an empty list to store the result
    val result = mutableListOf<Any>()

    // Check if both arrays are of the same length
    if (arr1.size != arr2.size) {
        return listOf("Error: The input arrays should have the same length.")
    }

    // Iterate through the elements of the arrays
    for (i in arr1.indices) {
        // Multiply the elements of arr1 and arr2 at the same index
        val element = arr1[i] * arr2[i]
        // Check if the element is divisible by 3 and replace it with 'divisible'
        result.add(if (element % 3 == 0) "divisible" else element)
    }

    return result
}